mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-03-25 18:30:24 +00:00
Update example in static_site_generation docs to use new-style route API
This commit is contained in:
parent
06c79d4866
commit
4fde40df92
1 changed files with 3 additions and 1 deletions
|
|
@ -45,6 +45,8 @@ For example, let's say we have a Blog Index which uses pagination. We can overri
|
|||
|
||||
.. code:: python
|
||||
|
||||
from wagtail.wagtailcore.url_routing import RouteResult
|
||||
|
||||
class BlogIndex(Page):
|
||||
...
|
||||
|
||||
|
|
@ -54,7 +56,7 @@ For example, let's say we have a Blog Index which uses pagination. We can overri
|
|||
def route(self, request, path_components):
|
||||
if self.live and len(path_components) == 2 and path_components[0] == 'page':
|
||||
try:
|
||||
return self.serve(request, page=int(path_components[1]))
|
||||
return RouteResult(self, kwargs={'page': int(path_components[1])})
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue