SQL optimization, avoid query in pre_save_polymorphic()

This query is visible in the django-debug-toolbar POST redirect page
fix_request_path_info
Diederik van der Boor 2012-11-15 10:42:02 +01:00
parent 28b8885236
commit f687dc18b1
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ class PolymorphicModel(models.Model):
field to figure out the real class of this object field to figure out the real class of this object
(used by PolymorphicQuerySet._get_real_instances) (used by PolymorphicQuerySet._get_real_instances)
""" """
if not self.polymorphic_ctype: if not self.polymorphic_ctype_id:
self.polymorphic_ctype = ContentType.objects.get_for_model(self) self.polymorphic_ctype = ContentType.objects.get_for_model(self)
def save(self, *args, **kwargs): def save(self, *args, **kwargs):