My bad...twas failiing cuz I didn't spell enctype properly...all good.
On Sep 3, 11:50 am, deecodameeko wrote:
> Thanks guys,
>
> I switched to using the clean method to check multiple fields however
> the file is always None even if I have browsed and found a file I want
> to upload.
>
> def cle
Thanks guys,
I switched to using the clean method to check multiple fields however
the file is always None even if I have browsed and found a file I want
to upload.
def clean(self):
cleaned_data = self.cleaned_data
store_id = cleaned_data.get('store_id')
categ
Two things going on here:
1) Validation that involves checking multiple fields should be done in
the form's clean() method rather than its clean_FIELDNAME method. Not
all fields are guaranteed to have been added to cleaned_data until you
reach the clean() method.
2) Try using self.cleaned_data.
Any validation which has to do with multiple fields should be done in
the clean() override, not within the individual field validator.
You can't rely on cleaned_data existing before that point.
http://docs.djangoproject.com/en/dev/ref/forms/validation/#cleaning-and-validating-fields-that-depend-o
Hi,
I have a file in a form. The file is optional but if the file is not
None, then some other form fields are required as well. For example
the following code checks one of the fields that's required when the
file fields isn't empty:
file= forms.FileField(required=False)
def clean_
5 matches
Mail list logo