Skip to content

Commit 7ca1d5a

Browse files
committed
Avoid ContentType db query, use cache instead
1 parent c0afd31 commit 7ca1d5a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

polymorphic_tree/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ def get_child_types(self):
122122
except ValueError:
123123
app_label = self._meta.app_label
124124
model = child
125-
ct_id = ContentType.objects.get(app_label=app_label,
126-
model=model).id
125+
ct_id = ContentType.objects.get_by_natural_key(app_label, model).id
127126
else:
128127
# pass in a model class
129128
ct_id = ContentType.objects.get_for_model(child).id

0 commit comments

Comments
 (0)