Added routing for RoutablePages

This commit is contained in:
David 2017-04-27 23:26:00 -06:00
parent e830a104b2
commit 2950a8f75b

View file

@ -263,6 +263,20 @@ def _new_route(self, request, path_components):
"""
Rewrite route method in order to handle languages fallbacks
"""
## copied from wagtail/contrib/wagtailroutablepage/models.py mixin ##
# Override route when Page is also RoutablePage
if hasattr(self, 'resolve_subpage'):
if self.live:
try:
path = '/'
if path_components:
path += '/'.join(path_components) + '/'
view, args, kwargs = self.resolve_subpage(path)
return RouteResult(self, args=(view, args, kwargs))
except Http404:
pass
if path_components:
# request is for a child of this page
child_slug = path_components[0]