Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83680

Re: Broken IF statement

References <dd384c6d-17c0-4850-ad5b-6b073c80bdb8@googlegroups.com>
From Maxime S <maxischmeii@gmail.com>
Date 2015-01-13 10:31 +0100
Subject Re: Broken IF statement
Newsgroups comp.lang.python
Message-ID <mailman.17668.1421143058.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

2015-01-12 22:19 GMT+01:00 <joboppsgpp@gmail.com>:
>
> https://bpaste.net/show/93be9e15634b <--- Line 19 through 22
>
> At all times, my program is assigning the object priority of 0, even if
one already exists in the database with a priority of 0 (it's supposed to
be assigning it a priority of 1 in those cases).
>
> I'm a non developer trying to fix a freelancer's code. Would anybody be
able to suggest changes to the IF logic that might be able to fix it,
assuming the statements in the code provided look flawed?
>
> Thanks...
> --
> https://mail.python.org/mailman/listinfo/python-list


This line:

obj, created = SocialAccount.objects.get_or_create(...)

suggest you are using Django. If it is the case you have to add obj.save()
after changing the priority to send the new value to the DB.

Best,

Maxime

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Broken IF statement joboppsgpp@gmail.com - 2015-01-12 13:19 -0800
  Re: Broken IF statement Chris Angelico <rosuav@gmail.com> - 2015-01-13 08:40 +1100
    Re: Broken IF statement joboppsgpp@gmail.com - 2015-01-12 13:55 -0800
      Re: Broken IF statement joboppsgpp@gmail.com - 2015-01-13 06:28 -0800
  Re: Broken IF statement Maxime S <maxischmeii@gmail.com> - 2015-01-13 10:31 +0100
    Re: Broken IF statement joboppsgpp@gmail.com - 2015-01-13 06:29 -0800

csiph-web