Wednesday, June 6, 2012

Re: Getting the last modified datetime from a DateTimeField

Thank you for your reply.

Ok so if I type out:

m = Model.objects.get(id=1)

then

m.date

Will give me the date and time of the last time it was saved? Because that is not what I am seeing. I am seeing the date the model was first created.

On Tuesday, June 5, 2012 12:33:36 PM UTC-7, Jesus Noland wrote:
Hello everyone,

I am using Django 1.3 on Python 2.7 and I have a field in a model setup like this:

date = models.DateTimeField(auto_now=True, auto_now_add=True)

now I would like to know how to get the last modified date from this field if my model
is called 'm':

m.date.last_modified ???

Your help is greatly appreciated. Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1do-g1IzD_wJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate