You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
Django has that nice "auto_add=True" property you can set on a model's
field. I have two fields in my models called "created_at" and
"updated_at" that keeps track of each model instance's creation/
modification date. It's incredibly easy.
I also want to keep track of which user created/updated each instance.
Right now, I'm doing this from my views -- I just get the user from
the request object and manually populate my "created_by" and
"updated_by" fields. This definitely violates the DRY principle... I
would love to move this code into my model code (by maybe overriding
the save method), but I don't think I have access to the request
object in my models.
Any suggestions? Thanks!
Richard Dahl
unread,
May 16, 2008, 1:03:43 PM5/16/08
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
This can be done with the threadlocals middleware: