File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 22from django .contrib .contenttypes .models import ContentType
33from django .contrib .postgres .aggregates import JSONBAgg
44from django .db .models import OuterRef , Subquery , Q
5+ from django .db .utils import ProgrammingError
56
67from extras .models .tags import TaggedItem
78from utilities .query_functions import EmptyGroupByJSONBAgg
@@ -160,7 +161,13 @@ class ObjectChangeQuerySet(RestrictedQuerySet):
160161 def valid_models (self ):
161162 # Exclude any change records which refer to an instance of a model that's no longer installed. This
162163 # can happen when a plugin is removed but its data remains in the database, for example.
164+ try :
165+ content_types = ContentType .objects .get_for_models (* apps .get_models ()).values ()
166+ except ProgrammingError :
167+ # Handle the case where the database schema has not yet been initialized
168+ content_types = ContentType .objects .none ()
169+
163170 content_type_ids = set (
164- ct .pk for ct in ContentType . objects . get_for_models ( * apps . get_models ()). values ()
171+ ct .pk for ct in content_types
165172 )
166173 return self .filter (changed_object_type_id__in = content_type_ids )
You can’t perform that action at this time.
0 commit comments