On Jan 25, 12:55 pm, todd <[EMAIL PROTECTED]> wrote:
> class Image(models.Model):
>     image = models.ImageField(upload_to='/PATH/site/files',
> blank=True, unique=True)

I would suggest renaming the class Image to something else because the
Python Imaging Library provides a class by that same name and you want
to avoid any clashes between that and your class.

>
>     class Admin: pass
>
>     def __str__(self):
>         return self.image
>
> class Client(models.Model):
>     name = models.CharField(maxlength=255)
>     street = models.CharField(maxlength=255)
>     house_num = models.CharField(maxlength=4)
>     house_level = models.CharField(maxlength=3, blank=True)
>     tel_num = models.CharField(maxlength=19, blank=True)
>     email = models.EmailField(blank=True)
>     url = models.ForeignKey(Url, blank=True)
>     image = models.ManyToManyField(Image, blank=True)

This is just a convention but here I would suggest renaming this field
name to images since it's a many to many field.

Lastly, you mentioned that you get a MySQL error on the image field in
Client. I suspect that when you changed that field from an ImageField
to an M2M field, you did not regenerate the model in your database.
When you change a model's structure like that then syncdb does not
automatically recreate your model with the changes. You either have to
make the corresponding database changes manual (using appropriate
ALTER TABLE statements) or if you are just developing and testing
things, reset your database.

See the warning box in: 
http://www.djangoproject.com/documentation/django-admin/#syncdb


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
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