Based on Django 1.3 documentation for transactions, it seems you can
have all or nothing updates of database calls within a view. I am not
getting the expected behavior and it seems there must be an
"autocommit" global setting somewhere that I need to set to false.
Does anyone know of such a setting? Here is sample code, I would
expect no updates to my "Credit" table, yet I get one new row.

@transaction.commit_on_success
def Test(request):
    try:
        member = request.user.get_profile()
        Credit.objects.create(CreditDate=datetime.datetime.now(),
Member=member, CreditAmount=25)
        Credit.objects.create(CreditDate=datetime.datetime.now(),
Member=member, CreditAmount=25.0) #FAIL

        return render_to_response("Test.html")
    except(Exception),e:
        WriteToLog('error in test: ' + e.__str__())
        return HttpResponseServerError('error')

Do I need to use @transaction.commit_manually instead? I know that
gives me the expected results but is a lot more work to update all my
code with manual commits and rollbacks. 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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to