Hello,
I have the following code in a ModelForm to ensure that the date the user
inputs does not exceed 99 years, the strange behavior is that this validation
works unless I spam the input button on my form webpage.
def clean(self):
cleaned_data = self.cleaned_data
pub_date = cleaned_data.get("date")
now = date.today()
if relativedelta(pub_date, now) > relativedelta(years=99):
msg = u"The date cannot exceed 99 years in the future."
self._errors["date"] = self.error_class([msg])
del cleaned_data["date"]
return cleaned_data
Did I miss something for the correct processing of form validation? Or is it
only a problem with Django's builtin server?
Thanks in advance,
Thomas Gautier.
--
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.