Hi,

i have a model (using newforms) where i have an image upload field.
Now i'm trying to check the image dimensions amongst other things.
I thought i could do this using validators.
It doesn't seem to call the validator specified in the model though.

How can i validate data?

def validate_image_size(field_data, all_data):
    ... validation code ...

class Icon(models.Model):
    class Admin:
        pass
    name = models.CharField(maxlength=60, blank=False)
    image = models.ImageField(upload_to="img/icons/", blank=True,
validator_list=[validate_image_size])

I then tried by making my own Image class and changing the ImageField in
the model

class Icon(models.Model):
    ...
    image = LinksImageField(upload_to="img/icons/", blank=True)

class LinksImageField(models.ImageField):
    def __init__(self, *args, **kwargs):
        super(LinksImageField,self).__init__(*args, **kwargs)

but then i'm unsure what function to specify here to validate the data.

Thanks,
Benedict


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to