logo       

Re: clean_<fieldname>() doesn't handle images?: msg#02259

DjangoUsers

Subject: Re: clean_<fieldname>() doesn't handle images?


I don't understand, sorry :$. Do you care to explain a little bit
more? Or could you give an example?

I'm using the admin interface btw.

On 31 jul, 01:45, Karen Tracey <kmtra...@xxxxxxxxx> wrote:
> On Thu, Jul 30, 2009 at 4:02 PM, Martje <martijn.basti...@xxxxxxxxx> wrote:
>
> > Hey,
>
> > I've got the following code in my models.py:
>
> > from django import forms
> > class Foto(models.Model):
> >    omschrijving = models.CharField(max_length=100)
> >    afbeelding = models.ImageField(upload_to='media/afbeeldingen/
> > header/fotos')
>
> >    def clean_afbeelding(self):
> >        raise forms.ValidationError("Never good! :-)")
>
> > Still, if I upload an image it validates, where it shouldn't, right?
>
> Custom clean methods need to be added to the form you are using, not the
> model.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@xxxxxxxxxxxxxxxx
To unsubscribe from this group, send email to
django-users+unsubscribe@xxxxxxxxxxxxxxxx
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Google Custom Search

News | Mail Home | sitemap | FAQ | advertise