django - In Wagtail, how can I add a form to the bottom of another model's form in the WagtailAdmin, for a OneToOneField relationship? -
in wagtail, let's have page this:
class mypage(page): field_1 = richtextfield() field_2 = models.datefield() content_panels = page.content_panels + [ fieldpanel('field_1'), fieldpanel('field_2'), ]
and have model has one-to-one relationship first model:
class pagesettings(models.model): page = models.onetoonefield(mypage) extra_setting_1 = models.booleanfield() extra_setting_2 = models.charfield(max_length=50)
how can add form pagesettings model bottom of wagtail admin form mypage model?
bonus points way generic relationships.
class mypage(page): field_1 = richtextfield() field_2 = models.datefield() content_panels = page.content_panels + [ fieldpanel('field_1'), fieldpanel('field_2'), inlinepanel('settings', label='settings', min_num=1, max_num=1), ] class pagesettings(models.model): page = parentkey(mypage, related_name='settings') extra_setting_1 = models.booleanfield() extra_setting_2 = models.charfield(max_length=50)
Comments
Post a Comment