I'm new to FeinCMS and I'm trying to create my own content type. That uses another custom content type I created.
In the code below "CollapsiblePanel" does not show in the admin as I only want you to be able to create "CollapsiblePanels" from the ContentBox section.
You can also create multiple CollapsiblePanels for each ContentBox. I'm having trouble figuring out how to wire this together so the admin allows you to add the CollapsiblePanels inside the ContentBox
class CollapsiblePanel(models.Model):
title = models.CharField(max_length=255)
content = models.TextField()
def render(self, **kwargs):
return render_to_string('collapsiblepanel.django.html', {
'media': self,
'title': mark_safe(self.title),
'text': mark_safe(self.content),
})
class ContentBoxMedia(RichTextContent):
title = models.CharField(_('title'), max_length=200, blank=True)
collapsible = models.BooleanField()
collapsiblePanels = models.ForeignKey(CollapsiblePanel)
class Meta:
abstract = True
verbose_name = 'Content Box'
verbose_name_plural = 'Content Box'
def render(self, **kwargs):
return render_to_string('contentbox.django.html', {
'media': self,
'title': mark_safe(self.title),
'text': mark_safe(self.text),
})