Update documentation to indicate that SnippetChooserPanel no longer requires a snippet_type argument

pull/1648/head
Matt Westcott 2015-08-28 10:50:32 +01:00
rodzic 6a7a23364b
commit 2ed16e3ee2
3 zmienionych plików z 10 dodań i 6 usunięć

Wyświetl plik

@ -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"),
]

Wyświetl plik

@ -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.

Wyświetl plik

@ -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