Hi!
I would like to create a form for model using ModelForms. Here's a
code:
class ContractForm(forms.ModelForm):
date1=forms.DateField(required=False,
input_formats=['%d/%m/%y', '%d.%m.
%y',
'%d/%m/%Y', '%d.%m.
%Y'], widget=AdminDateWidget)
date2=forms.DateField(required=False,
input_formats=['%d/%m/%y', '%d.%m.%y',
'%d/%m/%Y', '%d.%m.
%Y'], widget=AdminDateWidget)
class Meta:
model=Contract
As you can see, I've used my own input_formats for date fields
(because in my country no one is used to american formats).
The problem is that if I create form for instance using
ContractForm(instance=something) the dates of instance are rendered
using default format, not formats I've defined using input_formats.
What is the most painless way to get the dates in instance forms
rendered the way I want?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---