Opened 7 years ago

Closed 6 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: UI/UX:

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

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by matehat

Patch for the django/forms/fields.py file

comment:1 Changed 7 years ago by matehat

  • Cc mathieu.damours@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 6 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(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