"Like FileField, but validates that the uploaded object is a valid
image. Has two extra optional arguments, height_field and width_field,
which, if set, will be auto-populated with the height and width of the
image each time a model instance is saved."

So I made this model:

class Foto(models.Model):
   # import os, os.path, Image
   PhotoFile = models.ImageField(upload_to= PH_FOLDER + "/%Y/%m/%d/",
height_field="H", width_field="W")
   titel = models.CharField(maxlength=80)

I tried to get the dimension of the imageobject in my template using
{{ object.W }}
{{ object.width }}
{{ object.width_field }}

Without succes. After adding the fields to the model I got an error
because I had to fill the fields. No auto population!!

How does this work?


--~--~---------~--~----~------------~-------~--~----~
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