我在这里问了一个关于 manytomanyfield 的问题,我解决了这个问题,但现在提出了一个新问题,
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 ...
我知道为什么会出现这个问题,但我不知道该怎么做。我有一个与 Group 模型和 Gallery 模型有关的照片模型。当我从图库中添加图像时效果很好,但删除它时,会引发 Group 没有任何关系的问题...
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)
感谢您的所有帮助。