i have asked a question about manytomanyfield here which i solved but now a new problem is raised as,
DatabaseError at /admin/myapp/photo/8/delete/
relation "woek_gallery_photos" does not exist
LINE 1: DELETE FROM "woek_gallery_photos" WHERE "photo_id" IN ...
i know why this problem raises but i dont know how to. i have one Photo model which has relation with both Group model and Gallery model. when i add an image from Gallery it works good but as to deleting it, raises problem with Group about not having any relation…
class Gallery(models.Model):
....
photos = models.ManyToManyField('Photo', related_name='galleries',
verbose_name=_('Gallery'),
null=True, blank=True)
class Group(models.Model):
...
photos = models.ManyToManyField('Photo', related_name='galleries',
verbose_name=_('Group'),
null=True, blank=True,
through='through=GroupPhotos')
class Photo(models.Model):
image = models.ImageField(verbose_name = "Browse",
upload_to=myPath)
I appreciate your all helping.
That error means the join table for the relationship between
PhotoandGalleryis missing or was never created in the first place. If you haven’t done so already run:If that still doesn’t work, create the table manually. You can run:
to get the proper SQL to use. Look for the lines where it creates
woek_gallery_photosand copy that bit. Then run:And paste it at the prompt. Hit enter, and you should be good to go.