0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-24 01:57:32 +01:00

Don't fetch all related instances when creating revision object

This commit is contained in:
Jake Howard 2024-10-29 15:03:12 +00:00 committed by Matt Westcott
parent aa1a848bf2
commit f68dd505d0

View File

@ -2788,7 +2788,7 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
# These should definitely never change between revisions
obj.id = self.id
obj.pk = self.pk
obj.content_type = self.content_type
obj.content_type_id = self.content_type_id
# Override possibly-outdated tree parameter fields
obj.path = self.path
@ -2804,15 +2804,15 @@ class Page(AbstractPage, index.Indexed, ClusterableModel, metaclass=PageBase):
obj.draft_title = self.draft_title
obj.live = self.live
obj.has_unpublished_changes = self.has_unpublished_changes
obj.owner = self.owner
obj.owner_id = self.owner_id
obj.locked = self.locked
obj.locked_by = self.locked_by
obj.locked_by_id = self.locked_by_id
obj.locked_at = self.locked_at
obj.latest_revision = self.latest_revision
obj.latest_revision_id = self.latest_revision_id
obj.latest_revision_created_at = self.latest_revision_created_at
obj.first_published_at = self.first_published_at
obj.translation_key = self.translation_key
obj.locale = self.locale
obj.locale_id = self.locale_id
obj.alias_of_id = self.alias_of_id
revision_comment_positions = dict(
getattr(obj, COMMENTS_RELATION_NAME).values_list("id", "position")