Thanks for that tip Ryan. Here's the relevant models.py code I used to
get this to _almost_ work:
-----------------
class AuditedTable(models.Model):
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)
class Meta:
abstract = True
def save_model(self, request, obj, form, change):
if change:
updated_by = request.user
else:
created_by = request.user
class Entity1(AuditedTable):
title = models.CharField(max_length=20)
def __unicode__(self):
return self.title
------------------------
The initial record creation works great, but on update, the user ID is
returned by request.user instead of the user name. Anybody have ideas
how to fix that?
On May 29, 12:37 am, Ryan <[email protected]> wrote:
> This will show you how to achieve this in the django
> admin:https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contr...
--
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.