FeinCMS only allows content once per page object

Is there some kind of default action allowing the contenttype only once per page, and the other is overriding the admin form? The documentation is unclear about this.

+4
source share
1 answer

I don’t think there is a ready-made implementation, you could offer it to Github . Since the FeinCMS content type is an abstract class of the Django Model, you can use its pure method, for example.

class FooContent(models.Model): content = models.Bar('...') class Meta: abstract = True def clean(self): if self.parent.foocontent_set.count() >= 1: raise ValidationError('FooContent is only allowed once per Page.') def render(self, **kwargs): return render_to_string('content/foo.html', { 'content': self.content }) 

This will result in an unpaired error in the admin form.

+2
source

All Articles