Opened 15 years ago

Closed 14 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

Description

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 15 years ago.
Patch for the django/forms/fields.py file

Download all attachments as: .zip

Change History (4)

by matehat, 15 years ago

Attachment: fields.diff added

Patch for the django/forms/fields.py file

comment:1 by matehat, 15 years ago

Cc: mathieu.damours@… added

comment:2 by Jacob, 15 years ago

Triage Stage: UnreviewedDesign decision needed

comment:3 by Jannis Leidel, 14 years ago

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