I am developing a game in which the quantity of rebels updates after a turn 
change. Rebels are represented as integers from 0 to 100 in the (MySQL) 
database.

When I save, this happens:

print world.rebels>>> 0

rebstab = 0
world.rebels += rebstab
world.save()
print world.rebels>>> 0

However, when I use F() expressions (as I gather I should to prevent race 
conditions), this happens:

print world.rebels>>> 0

rebstab = 0
world.rebels = F('rebels') + rebstab
world.save()
print world.rebels>>> 100

What's going on?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d49909f9-180d-4144-89c5-dcf00bf8f560%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to