Re: Admin field custom validation

2008-09-29 Thread David Reynolds
On 21 Sep 2008, at 8:11 pm, [EMAIL PROTECTED] wrote: > > Hello Daniel, > > Thank you for your reply. > > I guess then that I cannot test image heights and widths on a form > pre- > save, because that is the only reason I can think of for this error > after forum submissal (if I use clean_logo)

Re: Admin field custom validation

2008-09-21 Thread [EMAIL PROTECTED]
Hello Daniel, Thank you for your reply. I guess then that I cannot test image heights and widths on a form pre- save, because that is the only reason I can think of for this error after forum submissal (if I use clean_logo) 'NoneType' object is unsubscriptable. Does that make sense ? --~--~

Re: Admin field custom validation

2008-09-21 Thread Daniel Roseman
On Sep 21, 6:01 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Having done a bit more research I see this often used as: > > clean_fieldname(self) rather than clean(self) > > which I guess would eleviate my problem, as my clean(self) function > doesn't appear to remember or pass on the rest

Re: Admin field custom validation

2008-09-21 Thread [EMAIL PROTECTED]
Having done a bit more research I see this often used as: clean_fieldname(self) rather than clean(self) which I guess would eleviate my problem, as my clean(self) function doesn't appear to remember or pass on the rest of the submitted field information. However when I try the above I get: 'None

Re: Admin field custom validation

2008-09-21 Thread [EMAIL PROTECTED]
Sorry I was wrong, if I try to submit a NEW logo that is too large it fails correctly. But when I try to add a new logo that is the right size it enters a fully blank row into the database. Thanks --~--~-~--~~~---~--~~ You received this message because you are subs

Admin field custom validation

2008-09-21 Thread [EMAIL PROTECTED]
Hi, This is my code: class LogoAdminForm(forms.ModelForm): class Meta: model = Logo def clean(self): from django.core.files.images import get_image_dimensions logo = self.cleaned_data['logo'] w, h = get_image_dimensions(logo) if w > 150 or h > 150: