我正在为旋转木马创建一个自定义插件,有两个模型:Gallery和Picture。这是模型的样子:
class Gallery(models.Model):
name = models.CharField(max_length=30)
def __unicode__(self): # Python 3: def __str__(self):
return self.name
class Picture(models.Model):
gallery = models.ForeignKey(Gallery)
image = models.ImageField(upload_to="uploads/images/")
title = models.CharField(max_length=30, null=True, blank=True)
tagline = models.CharField(max_length=30)
description = models.CharField(max_length=100)
page_link = PageField(related_name="Page", null=True, blank=True)
class GalleryPlugin(CMSPlugin):
name = _("Gallery Plugin")
gallery = models.ForeignKey(Gallery)
def copy_relations(self, oldinstance):
self.sections = oldinstance.sections.all()
问题在于我无法弄清楚管理员如何直接从前端编辑界面编辑图片。我尝试了各种内联编辑选项,似乎没什么用。