python - FeinCMS allow a contenttype only once per page object -
is there default action allow contenttype once per page, other overriding admin form? documentation unclear this
i don't think there's out-of-the-box implementation, suggested 1 @ github. since feincms content type abstract django model class use clean method, e.g.
class foocontent(models.model): content = models.bar('...') class meta: abstract = true def clean(self): if self.parent.foocontent_set.count() >= 1: raise validationerror('foocontent allowed once per page.') def render(self, **kwargs): return render_to_string('content/foo.html', { 'content': self.content })
this raise non field error on admin form.