Re: Discard an uploaded image when returning a form with errors

2008-07-03 Thread TiNo
If the image verifies, and is on your server already, why not resize it? :D On Thu, Jul 3, 2008 at 11:49 PM, Berco Beute <[EMAIL PROTECTED]> wrote: > > To answer my own question, I now moved the validation code to the form > and create a PIL image using > Image.open(StringIO(uploadedFile.content))

Re: Discard an uploaded image when returning a form with errors

2008-07-03 Thread Berco Beute
To answer my own question, I now moved the validation code to the form and create a PIL image using Image.open(StringIO(uploadedFile.content)): ===forms.py class ImageForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ImageForm, self).__init__(*args, **kwargs) de

Re: Discard an uploaded image when returning a form with errors

2008-07-03 Thread Berco Beute
Something tells me the validation actually belongs to the form, but how can I get to the image size from within the form? ===forms.py class ImageForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(ImageForm, self).__init__(*args, **kwargs) def clean_image(self):