Wednesday, February 29, 2012

DateField - format in Django 1.3.1


I saw there was some problems in the format which is rendered,
validated and stored using a DateField in a form, and in a model. Are
they still unresolved in 1.3.1 versio?, it's not working for me ....

My form:
32 class EventForm(forms.Form):
33 name =
34 startDate = forms.DateField(input_formats=['%d/%m/
%Y'],label=_('sta rtDate'),
35 endDate = forms.DateField(input_formats=['%d/%m/
%Y'],label=_('endDa te'),

My model:
34 class Event(models.Model):
35 eventID = models.AutoField(primary_key=True)
36 name = models.CharField(max_length=100,null=False,blank=False)
38 startDate = models.DateField('%d/%m/
39 endDate = models.DateField('%d/%m/

And the POST message:
POST:<QueryDict: {u'startDate': [u'01/01/2012'], u'endDate':
[u'31/12/2012'], u'name': [Year 2012']}>,

The render is properly drawn.

Tanks a lot,

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment