Django

Code

Ticket #5526 (new)

Opened 1 year ago

Last modified 3 months ago

Localized Date/DateTime fields proposal

Reported by: janr Assigned to: nobody
Milestone: post-1.0 Component: django.contrib.localflavor
Version: SVN Keywords: i18n-rf
Cc: Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

This is an attempt at providing Date/DateTime fields for locales other than English. The patch provides a DateField, DateTimeField and DateTimeInput widget that accept Dutch input.

It should be relatively easy to add additional locales (at least, that was the setup) .

Short example:

>>> from django.contrib.localflavor.nl.forms import DateField
>>> f = DateField()
>>> f.clean('25 augustus 2003')
datetime.date(2003, 8, 25)

>>> from django.contrib.localflavor.nl.widgets import DateTimeInput
>>> d = DateTimeInput(date_output_format='%d %B %Y')
>>> d.render('foo', datetime.now())
u'<input type="text" name="foo" value="17 september 2007" />'

Attachments

localflavor_datetimefields.patch (12.6 kB) - added by janr on 09/18/07 14:31:52.
Reattached the patch

Change History

09/18/07 14:31:52 changed by janr

  • attachment localflavor_datetimefields.patch added.

Reattached the patch

09/20/07 03:32:49 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

Interesting idea janr - can you float this on django-developers?

09/20/07 13:58:19 changed by janr

08/11/08 10:47:52 changed by garcia_marc

  • keywords set to i18n-rf.

09/03/08 09:01:19 changed by anonymous

  • milestone set to post-1.0.

Add/Change #5526 (Localized Date/DateTime fields proposal)




Change Properties
Action