Thursday, April 5, 2012

Re: Can't display DateField on form with auto_now = True

On Thu, Apr 5, 2012 at 1:27 PM, Joel Goldstick <joel.goldstick@gmail.com> wrote:
> 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

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
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