Changed __unicode__ to __str__

pull/1629/head
Alex Gleason 2015-08-20 22:30:55 -05:00
rodzic e73e21a827
commit e09acbea2d
1 zmienionych plików z 3 dodań i 3 usunięć

Wyświetl plik

@ -32,12 +32,12 @@ Here's an example snippet from the Wagtail demo website:
FieldPanel('text'),
]
def __unicode__(self):
def __str__(self):
return self.text
The ``Advert`` model uses the basic Django model class and defines two properties: text and URL. The editing interface is very close to that provided for ``Page``-derived models, with fields assigned in the panels property. Snippets do not use multiple tabs of fields, nor do they provide the "save as draft" or "submit for moderation" features.
``@register_snippet`` tells Wagtail to treat the model as a snippet. The ``panels`` list defines the fields to show on the snippet editing page. It's also important to provide a string representation of the class through ``def __unicode__(self):`` so that the snippet objects make sense when listed in the Wagtail admin.
``@register_snippet`` tells Wagtail to treat the model as a snippet. The ``panels`` list defines the fields to show on the snippet editing page. It's also important to provide a string representation of the class through ``def __str__(self):`` so that the snippet objects make sense when listed in the Wagtail admin.
Including Snippets in Template Tags
-----------------------------------
@ -145,7 +145,7 @@ To attach multiple adverts to a page, the ``SnippetChooserPanel`` can be placed
SnippetChooserPanel('advert', Advert),
]
def __unicode__(self):
def __str__(self):
return self.page.title + " -> " + self.advert.text