Hey Everyone,

Somehow my imageField is not working. I have set the upload to and the
MEDIA_ROOT setting. I tried changing the imageField to fileField and it
worked just fine (uploaded the file and placed it in database). As soon
as I change it to imageField it dies on me. Something about PIL that I
have no idea what it means. Please help.

-----------------------------------------------------
There's been an error:

Traceback (most recent call last):

  File "C:\Python24\lib\site-packages\django\core\handlers\base.py",
line 64, in get_response
    response = callback(request, **param_dict)

  File "C:\Python24\lib\site-packages\django\views\admin\main.py", line
873, in change_stage
    errors = manipulator.get_validation_errors(new_data)

  File "C:\Python24\lib\site-packages\django\core\formfields.py", line
69, in get_validation_errors
    validator(new_data.get(field.field_name, ''), new_data)

  File "C:\Python24\lib\site-packages\django\core\formfields.py", line
510, in isValidImage
    validators.isValidImage(field_data, all_data)

  File "C:\Python24\lib\site-packages\django\core\validators.py", line
130, in isValidImage
    from PIL import Image

ImportError: No module named PIL

---------------------------------------------------


Please note that my model is as follows:

class Person(meta.Model):
    # Book keeping data
    register_date = meta.DateTimeField('date published')
    updated_date = meta.DateTimeField('last updated',
auto_now_add=True)

    # Contact Info.
    address1 = meta.CharField(maxlength=250)
    address2 = meta.CharField(maxlength=250, null=True, blank=True)
    city = meta.CharField(maxlength=250)
    state = meta.USStateField()
    zip = meta.CharField(maxlength=250)
    phone = meta.PhoneNumberField()

    # Personal Info.
    first_name = meta.CharField(maxlength=200)
    last_name = meta.CharField(maxlength=200)
    birth_date = meta.DateField('birth date')
    height = meta.CharField(maxlength=5)
    photo = meta.ImageField(upload_to='people', null=True, blank=True)

    def __repr__(self):
        return "%s %s" % (self.first_name, self.last_name)

    class META:
        admin = meta.Admin()


Thanks for your support,
Armin

Reply via email to