I am trying to figure out what is the best way to have the below
information for each blog post.
Created_by
Created_on
Last_modified_by
Last_modified_on.
Is there a field that already logs who created a blog entry? Is there a
field that already logs when a Blog entry was created?
Using PHP, I would use system time for created_on and last_modified_on and
store it in fields in the database. I would use user.name as the
created_by and then the Last_modified_by.
I found the below code on stackoverflow.com and it seems like it will work,
but not sure if there is an easier or more efficient way in mezzanine.
This code does not contain the created_on or the last_modified_on but
would be easy to add them to the code.
def save_model(self, request, obj, form, change):
if hasattr(obj, 'created_by') and hasattr(obj, 'modified_by'):
if not change:
obj.created_by = request.user obj
obj.modified_by = request.user
else:
obj.modified_by = request.user
obj.save()
--
You received this message because you are subscribed to the Google Groups
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.