Moved it to admin.py but it ignores the auto_now parameters (leaving
timestamps blank) and doesn't populate the created_by/updated_by
fields either:
class AuditAdmin(admin.ModelAdmin):
  created = models.DateTimeField(auto_now_add=True)
  created_by = models.CharField(blank=True,max_length=20)
  updated = models.DateTimeField(auto_now=True)
  updated_by = models.CharField(blank=True,max_length=20)
  def save_model(self, request, obj, form, change):
    if change:
      obj.updated_by = request.user
    else:
      obj.created_by = request.user
    obj.save()

class Entity1Admin(AuditAdmin):
  inlines = (JoinTableInline,)

admin.site.register(Entity1,Entity1Admin)

---------------------------------
I inserted a sys.exit() line to dump request.user, and it has the
correct value, but it's not getting pushed to the database record.

Thanks very much for your help, do you have other ideas?

-- 
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