chrisglass/django_polymorphic — pull request #12 by vdboor (2012-11-15 09:51:02+00:00)
Title: Avoid SQL query in pre_save_polymorphic()

Hi.

When the model already has a `polymorphic_ctype_id`, testing for `self.polymorphic_ctype` will perform a `SELECT .. from django_content_type WHERE id = nn` query. This patch avoids that query by testing for `polymorphic_ctype_id` instead.

The query is visible in the django-debug-toolbar POST redirect page, when saving a polymorphic model.