Avoid creating log entries for revisions without page types

pull/6336/head
Dan Braghis 2020-08-12 09:52:55 +01:00 zatwierdzone przez Matt Westcott
rodzic 58f5c29252
commit 6837d2d512
1 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -14,6 +14,10 @@ class Command(BaseCommand):
def handle(self, *args, **options):
current_page_id = None
for revision in PageRevision.objects.order_by('page_id', 'created_at').select_related('page').iterator():
if not revision.page.specific_class:
# This revision is for a page type that is no longer in the database. Bail out early.
continue
is_new_page = revision.page_id != current_page_id
if is_new_page:
# reset previous revision when encountering a new page.