forms.py
DATE_INPUT_FORMAT = (
('%d/%m/%Y','%m/%d/%Y')
)
class ReportDatetimeForm(forms.ModelForm):
manual_date = forms.DateField(input_formats = DATE_INPUT_FORMAT,
widget=forms.DateInput(attrs={'size':'15','id':'datepicker','readonly':'readonly'}))
class Meta:
model = Report
fields = ['manual_date']
This is my form to get the input as date with two different format.While
giving input date in this format %m/%d/%Y' the date and month gets
interchange while save in database.That affects in my application.So i want
to save both input format in a single format namely yyyy-mm-dd,so what ever
input format the user enter ,the given format should save in the above
mentioned format.
I want to know how to write a custom function in forms.py to save the date
in database in single format.
Thanks
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.