Define a clean_date_posted to trim the decimals? On Feb 19, 8:25 am, "juampa" <[EMAIL PROTECTED]> wrote: > I have a certain model that contains a datetime field and I am using > newforms to create and edit entries for this model. One of the fields > in the model is a datetime set only for an entry creation. To modify > one of these entries, I create a form from the instance > (form_for_instance()) and set the datetime field to hidden > (widgets.HiddenInput()). The problem is that I get a validation error > upon submitting the modified entry because the HTML from the form > contains tha date as: > > <input type="hidden" name="date_posted" value="2007-02-19 > 09:36:22.531015" id="id_date_posted" /> > > but the corresponding field on the form does not accept all those > decimal places for the seconds in the time. > > Is there an elegant way to fix this or do I just have to manually > clean up the time before I save the modified entry? > > Thanks.
--~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---