Saturday, March 29, 2014

Django (1.5) login exception (Save with update_fields did not affect any rows)

In my Django web app (running on Google App Engine), when a new user signs up a User object is created and then that user is authenticated and logged in. Every once in a while, the login function throws an exception (DatabaseError: Save with update_fields did not affect any rows) and I'm not really sure why this is happening (this is my first Django app).

newuser = User.objects.create_user(username, "", password)        newuser.first_name = username      newuser.save()           # Create and save an associated accounts table to the system      models.Accounts(user=newuser).save()          # Authenticate the new user      newuser = authenticate(username=username, password=password)        # This is the login that occasionally throws an exception      login(request, newuser)

--
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+unsubscribe@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/dd0fe745-91bc-41b0-bd5b-e8561b43e8e6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment