Django doesn't handle the transactions directly. It just has support for taking advantage of the transaction capabilities included in the database of your choice. It depends on your database system. Read up on transactions with database x to see how it will behave. With my understanding of transactions, I believe that they are there for that reason... to make sure multiple processes aren't colliding and mudding up your data.

Jeff Anderson

[EMAIL PROTECTED] wrote:
Let's say I have a model with an integer value. I'd like to increment
that value.

Multiple processes would like to increment that value.

Does the transaction middleware properly protect against this?

Example:
Processes P1, P2, model instance m, with m.val

- P1 grabs the object : m = MyModel.objects.filter(get the m i want)
[0]
- P2 grabs the object : m = MyModel.objects.filter(get the m i want)
[0]
- P1 m.val += 1
- P2 m.val += 1
- P1 m.save()
- P2 m.save()

What happens normally? What happens with the transaction middleware?

What happens if the view is more complicated and only conditionally
accesses certain models. Will all models actually accessed be properly
locked?

Thanks,
Ivan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---



Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to