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)