On Thu, Jul 30, 2009 at 4:02 PM, Martje <martijn.basti...@gmail.com> 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@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to