Transaction behaviour depends on database backend. What backend do you use and have you setup transaction support for it?
On 12 янв, 20:45, pength <[EMAIL PROTECTED]> wrote: > At first, I tried to search in this group, but only got an un-answered > question similar to > mine:http://groups.google.com/group/django-users/browse_thread/thread/7677... > > in my settings.py, i am using TransactionMiddleware. and my testing > views.py as following: > > def index(request): > c=Myobject.objects.get(pk=45) ###Myobject with a field 'isUpdate' > which default value is False. > c.isUpdate = True > c.save() > raise NameError > > after a request to this index view, I found in database that object's > 'isUpdate' was set to True... > > then I added an decorator: > @transaction.commit_on_success > def index(request): > c=Myobject.objects.get(pk=45) > ..... > > Then the object won't be changed. > > I am confused about this, because according to the Django document > about transaction, I think the default way is just commit_on_success? > or what mistake I have made? > > Thanks! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---