mirror of
https://github.com/wagtail/wagtail.git
synced 2024-11-30 01:46:24 +01:00
Provide clarification on specific page usage for autocreate_redirects_on_slug_change()
This commit is contained in:
parent
9cf5e491ef
commit
5fc75b312a
@ -35,6 +35,9 @@ def autocreate_redirects_on_slug_change(
|
||||
instance: Page,
|
||||
**kwargs
|
||||
):
|
||||
# NB: `page_slug_changed` provides specific page instances,
|
||||
# so we do not need to 'upcast' them for create_redirects here
|
||||
|
||||
if not getattr(settings, "WAGTAILREDIRECTS_AUTO_CREATE", True):
|
||||
return None
|
||||
|
||||
|
@ -493,7 +493,8 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
|
||||
# Basically: If update_fields has been specified, and slug is not included, skip this step
|
||||
if not ('update_fields' in kwargs and 'slug' not in kwargs['update_fields']):
|
||||
# see if the slug has changed from the record in the db, in which case we need to
|
||||
# update url_path of self and all descendants
|
||||
# update url_path of self and all descendants. Even though we might not need it,
|
||||
# the specific page is fetched here for sending to the 'page_slug_changed' signal.
|
||||
old_record = Page.objects.get(id=self.id).specific
|
||||
if old_record.slug != self.slug:
|
||||
self.set_url_path(self.get_parent())
|
||||
|
Loading…
Reference in New Issue
Block a user