In my model I have
id = models.AutoField(primary_key=True)
but upon saving a new record I get
null value in column "id" violates not-null constraint
I suspect this may be caused by my overriding save_model in admin.py to
populate timestamp fields:
def save_model(self, request, obj, form, change):
if change:
obj.updated_by = request.user.username
else:
obj.created_by = request.user.username
obj.save()
Any ideas on how to restore the AutoField functionality?
Thanks-
--
Lee
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.