Can't display DateField on form with auto_now = True

44 views
Skip to first unread message

Joel Goldstick

unread,
Apr 5, 2012, 1:27:10 PM4/5/12
to django...@googlegroups.com
I have a model with auto_now, and auto_now_add set for Update and Create fields:
class HotelProfiles(models.Model):
fe_result_id = models.AutoField(primary_key=True)
fe_created_date = models.DateTimeField(verbose_name='Created',
blank=True, auto_now_add=True)
fe_updated_date = models.DateTimeField(verbose_name='Updated',
blank=True, auto_now=True)

In the Admin it displays both fields but leaves them uneditable. They
don't seem to be passed to my form to be rendered. I don't want them
to be editable, but I would like to display at the top of my form.
How can I do this?
--
Joel Goldstick

Joel Goldstick

unread,
Apr 5, 2012, 4:27:44 PM4/5/12
to django...@googlegroups.com

I also posted this on Stack Exchange, and kept at it on my own. I
came up with a solution here:
http://stackoverflow.com/questions/10033422/cant-display-datefield-on-form-with-auto-now-true/10035262#10035262


--
Joel Goldstick

Reply all
Reply to author
Forward
0 new messages