I have a form that validates the size of a file and it works in one
page but not another. This is very strange. The only difference
between the two templates is that the working one has only a single
form (below) and the non-working one has 3 forms (including the form
below). For some reason, in a non-working situation the value of f is
None.
Anyone got any ideas? It is very strange and driving me crazy.. Django
1.0.2 is just not putting the UploadedFile object in cleaned_data when
I believe it should!
class DocumentFileUploadForm(forms.Form):
file1 = forms.FileField(label="Upload CV / Folio", required=False)
def clean(self):
f = self.cleaned_data.get('file1')
if f is None:
raise ValidationError("Please attach a CV!")
if f.size > settings.MAX_FILE_SIZE:
raise ValidationError("Total file size exceeds the allowed
limit")
return self.cleaned_data
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---