Forms Datefield ?

2 views
Skip to first unread message

dbo...@web.de

unread,
Nov 15, 2008, 4:37:41 PM11/15/08
to django...@googlegroups.com
hi, how do I change a datefield to d.m.Y in a form inherited from modelform ?
--------------------------------------------
r/Delle

Malcolm Tredinnick

unread,
Nov 15, 2008, 8:44:03 PM11/15/08
to django...@googlegroups.com

On Sat, 2008-11-15 at 22:37 +0100, dbo...@web.de wrote:
> hi, how do I change a datefield to d.m.Y in a form inherited from modelform ?

You can't change that automatically. You will need to create a subclass
of the model field that overrides the formfield() method to return a
forms.DateField with an appropriate input_formats parameter passed in.

In Django 1.1 there'll be optional support in the i18n framework so that
every locale will use their native date format (d/m/Y pretty much
everywhere except en-US) and that should make this a less common
question.

Regards,
Malcolm


Reply all
Reply to author
Forward
0 new messages