so lets say I have the following models set up for Wagtail:
@register_snippet
class MySnippet(models.Model):
name = models.CharField(max_length=200, null=True)
panels = [FieldPanel('name'),]
def __str__(self):
return self.name
class Meta:
ordering = ['name',]
class MyPage(Page):
body = StreamField([
('mysnippet', SnippetChooserBlock(required=False, label='MySnippet', target_model='MySnippet')),
], blank=True, help_text='')
content_panels = Page.content_panels + [
StreamFieldPanel('body', heading='Stuff to add'),
]
My client will be creating a lot of MySnippet
items as they go. It's going to be super awkward for them to move to another view in their CMS, create a MySnippet
, then come back to their main MyPage
editor to choose it.
Q1 Is there a simple way to add a SnippetChooseOrInlineCreate()
block so clients can add new MySnippet
s as they create MyPage
s?
Q2 If there's no existing simple way, how would you recommend approaching this?