Opened 10 years ago

Closed 9 years ago

#9979 closed (fixed)

localizing input_formats on DateField

Reported by: matehat Owned by: matehat
Component: Forms Version: 1.0
Severity: Keywords:
Cc: mathieu.damours@… Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I needed a DateField to be able to receive lazy ugettext objects and resolve them at validating time, but when I tried I got an error from the internal python date parser, so I just applied force_unicode on each passed format in the field's clean method and everything works fine. I attached the patch so you can check it out and merge it ASAP!

Currently, my modifications allows the input_formats parameter to be in the form of:

input_formats = ( _l('some_format'), _('some_other_format') ) # where _l is ugettext_lazy

Attachments (1)

fields.diff (1.4 KB) - added by matehat 10 years ago.
Patch for the django/forms/ file

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by matehat

Attachment: fields.diff added

Patch for the django/forms/ file

comment:1 Changed 10 years ago by matehat

Cc: mathieu.damours@… added

comment:2 Changed 10 years ago by Jacob

Triage Stage: UnreviewedDesign decision needed

comment:3 Changed 9 years ago by Jannis Leidel

Resolution: fixed
Status: newclosed

(In [11964]) Fixed #7980 - Improved i18n framework to support locale aware formatting (dates and numbers) and form processing.

Note: See TracTickets for help on using tickets.
Back to Top