diff --git a/docs/advanced_topics/customisation/page_editing_interface.rst b/docs/advanced_topics/customisation/page_editing_interface.rst index 51311d3c25..9e4161ce0e 100644 --- a/docs/advanced_topics/customisation/page_editing_interface.rst +++ b/docs/advanced_topics/customisation/page_editing_interface.rst @@ -23,7 +23,7 @@ As standard, Wagtail organises panels into three tabs: 'Content', 'Promote' and FieldPanel('body', classname="full"), ] sidebar_content_panels = [ - SnippetChooserPanel('advert', Advert), + SnippetChooserPanel('advert'), InlinePanel('related_links', label="Related links"), ] diff --git a/docs/reference/pages/editing_api.rst b/docs/reference/pages/editing_api.rst index 8a04eb0850..987b4eb9fd 100644 --- a/docs/reference/pages/editing_api.rst +++ b/docs/reference/pages/editing_api.rst @@ -233,9 +233,13 @@ DocumentChooserPanel SnippetChooserPanel ------------------- -.. class:: wagtail.wagtailsnippets.edit_handlers.SnippetChooserPanel(field_name, model) +.. versionchanged:: 1.1 - Snippets are vanilla Django models you create yourself without a Wagtail-provided base class. So using them as a field in a page requires specifying your own ``appname.modelname``. A chooser, ``SnippetChooserPanel``, is provided which takes the field name and snippet class. + Before Wagtail 1.1, it was necessary to pass the snippet model class as a second parameter to ``SnippetChooserPanel``. This is now automatically picked up from the field. + +.. class:: wagtail.wagtailsnippets.edit_handlers.SnippetChooserPanel(field_name, snippet_type=None) + + Snippets are vanilla Django models you create yourself without a Wagtail-provided base class. A chooser, ``SnippetChooserPanel``, is provided which takes the field name as an argument. .. code-block:: python @@ -251,7 +255,7 @@ SnippetChooserPanel ) content_panels = Page.content_panels + [ - SnippetChooserPanel('advert', Advert), + SnippetChooserPanel('advert'), ] See :ref:`snippets` for more information. diff --git a/docs/topics/snippets.rst b/docs/topics/snippets.rst index f0c76c4510..8e4defe79a 100644 --- a/docs/topics/snippets.rst +++ b/docs/topics/snippets.rst @@ -112,7 +112,7 @@ In the above example, the list of adverts is a fixed list, displayed as part of BookPage.content_panels = [ - SnippetChooserPanel('advert', Advert), + SnippetChooserPanel('advert'), # ... ] @@ -142,7 +142,7 @@ To attach multiple adverts to a page, the ``SnippetChooserPanel`` can be placed verbose_name_plural = "Advert Placements" panels = [ - SnippetChooserPanel('advert', Advert), + SnippetChooserPanel('advert'), ] def __str__(self): # __unicode__ on Python 2