Closed vaibhav-jain closed 9 years ago
log_entry.action_date gives you the datetime of the action.
Yeah but how do i access it using manager???
I need to show action datetime in templates in user specific time format.
Can you please tell me that should I use TimeStampedModel from django-extensions
along with audit-log
You can use TimeStampedModel from django-extensions on any model if you want to. Don't confuse it with AuthStampedModel from django-audit-log.
To get the datetime of a certain action you need to get an instance of the log entry for that action. You can't get it from the manager.
In the example that you gave log_entry.action_date will give you the datetime for that log_entry, it's not a string it's a datetime.
Thanks for your help. It was all my mistake.
self.audit_log.filter().order_by('-action_date')[0]
. I forgot .action_date
in the query self.audit_log.filter().order_by('-action_date')[0].action_date
. So sorry
I need to access
log_entry.action_date
value. Right now I can access<Customer: XXXX deleted at 2015-01-17 19:09:48.515000+00:00>
But how do I render thisstring
intodatetime
value in template????? Is their way of getting access tolog_entry.action_date
??