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