kopia lustrzana https://github.com/wagtail/wagtail
Add Page.get_route_paths() to support redirect creation for alternative routes
rodzic
f3a3f38a61
commit
ca3558e528
|
|
@ -1678,6 +1678,28 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
|
||||||
patch_cache_control(response, private=True)
|
patch_cache_control(response, private=True)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def get_route_paths(self):
|
||||||
|
"""
|
||||||
|
.. versionadded:: 2.16
|
||||||
|
|
||||||
|
Returns a list of paths that this page can be viewed at.
|
||||||
|
|
||||||
|
These values are combined with the dynamic portion of the page URL to
|
||||||
|
automatically create redirects when the page's URL changes.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
If using ``RoutablePageMixin``, you may want to override this method
|
||||||
|
to include the paths of popualar routes.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
Redirect paths are 'normalized' to apply consistant ordering to GET parameters,
|
||||||
|
so you don't need to include every variation. Fragment identifiers are discarded
|
||||||
|
too, so should be avoided.
|
||||||
|
"""
|
||||||
|
return ['/']
|
||||||
|
|
||||||
def get_cached_paths(self):
|
def get_cached_paths(self):
|
||||||
"""
|
"""
|
||||||
This returns a list of paths to invalidate in a frontend cache
|
This returns a list of paths to invalidate in a frontend cache
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue