1

I'm creating a custom plugin for a carousel, having two models: Gallery and Picture. Here's what the models look like:

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()

The problem is that I can't figure out how the admin could edit the Pictures directly from the frontend editing interface. I tried all kinds of inline editing options, nothing seemed to work.

jurasadam
  • 188
  • 8
  • It seems you want to have second-level inlines (that's because GalleryPlugin with gallery is one inline and then Picture would be second inline. This is generally very difficult (http://stackoverflow.com/questions/14308050/django-admin-nested-inline). You can add a link to a separate page though that would open for Picture edition. – seeg Dec 17 '13 at 17:20

0 Answers0