Re: What validation tests are applied to ImageField?

2018-02-20 Thread mtnhiker
Brilliant! Thanks (John) for following through. I had the same questions with the same responses you had to your answers. And I also don't have a form that starts the view. I have an image type that is not common (but is a standard), so hoped that the documentation comment "validates that

Re: What validation tests are applied to ImageField?

2010-03-22 Thread john2095
Thanks Tom. I don't know where it comes from but it seems deeply ingrained for me to expect the model to enforce the atomicity/ integrity of its objects. Just for anyone who stumbles over this thread and wants to know how it ends... In this application I'm not using a form (uploadify is a

Re: What validation tests are applied to ImageField?

2010-03-22 Thread Tom Evans
On Mon, Mar 22, 2010 at 6:51 AM, john2095 wrote: > But does this all amount to an expectation that it will restrict the > upload to an image?? > > I've got this in my model: > > class Photo(models.Model): >    image = models.ImageField(upload_to='photos') > > and this in my

Re: What validation tests are applied to ImageField?

2010-03-22 Thread john2095
But does this all amount to an expectation that it will restrict the upload to an image?? I've got this in my model: class Photo(models.Model): image = models.ImageField(upload_to='photos') and this in my view: try: p = Photo() p.image = request.FILES['Filedata']

Re: What validation tests are applied to ImageField?

2010-03-18 Thread john2095
Perfect. Thanks. That's what I was chasing. On Mar 17, 11:54 pm, Karen Tracey wrote: > > Validation of image fields is done at the form field level, see: > > http://code.djangoproject.com/browser/django/trunk/django/forms/field... > > Karen -- You received this message

Re: What validation tests are applied to ImageField?

2010-03-17 Thread thanos
DJango's ImageFields uses the PIL verify to check the image. trial_image = Image.open(file) trial_image.verify() See: http://www.pythonware.com/library/pil/handbook/image.htm On Mar 15, 10:56 pm, john2095 wrote: > The documentation states about the ImageField > > "Like

Re: What validation tests are applied to ImageField?

2010-03-17 Thread Karen Tracey
On Wed, Mar 17, 2010 at 1:51 AM, john2095 wrote: > Maybe I should post this on the developers list? > No. The topic for django-developers is the development of Django itself. Questions about the use of Django are off-topic and will be directed elsewhere. Validation of image

Re: What validation tests are applied to ImageField?

2010-03-17 Thread pjrhar...@gmail.com
> What constitutes a 'valid' image? > The documentation states "ImageField... Like FileField, but validates > that the uploaded object is a valid image." I haven't read through the code, but the error must be caught somewhere because I just tested it out. Trying to upload in the admin a random

Re: What validation tests are applied to ImageField?

2010-03-17 Thread Kenneth Gonsalves
On Wednesday 17 Mar 2010 11:21:45 am john2095 wrote: > Maybe I should post this on the developers list? Would that upset > them? > most of them read this list -- regards Kenneth Gonsalves Senior Associate NRC-FOSS http://certificate.nrcfoss.au-kbc.org.in -- You received this message because

Re: What validation tests are applied to ImageField?

2010-03-16 Thread john2095
> I assume Django is passing the file to PIL and asking if the file > is in a format that PIL can deal with and is in a valid format. My question is about the assumption... As far as I can find, it actually only uses PIL to read the file and return the dimensions. The code looks like if PIL

Re: What validation tests are applied to ImageField?

2010-03-15 Thread creecode
Hello John, On Mar 15, 7:56 pm, john2095 wrote: > Question is "What is the definition of a 'valid image'" in this > context?" > and, optionally, where is the source code for that? My understanding from what I've read is that most of the heavy lifting for image handling is

What validation tests are applied to ImageField?

2010-03-15 Thread john2095
The documentation states about the ImageField "Like FileField, but validates that the uploaded object is a valid image. Has two extra optional arguments:" http://docs.djangoproject.com/en/dev/ref/models/fields/#imagefield I went cruising the source to try and work out what tests are implemented