kopia lustrzana https://github.com/wagtail/wagtail
Update staticsitegen example to use new RoutablePage syntax
rodzic
62f1020606
commit
ad2dfd81a2
|
@ -58,21 +58,17 @@ Example:
|
|||
|
||||
.. code:: python
|
||||
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin
|
||||
from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin, route
|
||||
|
||||
|
||||
class BlogIndex(Page, RoutablePageMixin):
|
||||
...
|
||||
|
||||
subpage_urls = (
|
||||
url(r'^$', 'serve_page', {'page': 1}),
|
||||
url(r'^page/(?P<page>\d+)/$', 'serve_page', name='page'),
|
||||
)
|
||||
|
||||
@route(r'^$', name='main')
|
||||
@route(r'^page/(?P<page>\d+)/$', name='page')
|
||||
def serve_page(self, request, page=1):
|
||||
...
|
||||
|
||||
|
||||
Then in the template, you can use the ``{% routablepageurl %}`` tag to link between the pages:
|
||||
|
||||
.. code:: html+Django
|
||||
|
|
Ładowanie…
Reference in New Issue