Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #11302 -- Avoid unnesscary (and possibly unintentional)…

… queries/results from generic inline formsets.

When an instance with no primary key value is passed in to a generic inline
formset we ensure no queries/results occur. Thanks Alex Gaynor.

Backport of [10981] from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@10982 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit bbe034a74f33296f228a9d19fb3dc07072a079e7 1 parent ea5e5a2
Brian Rosner authored June 11, 2009

Showing 1 changed file with 1 addition and 1 deletion. Show diff stats Hide diff stats

  1. 2  django/contrib/contenttypes/generic.py
2  django/contrib/contenttypes/generic.py
@@ -317,7 +317,7 @@ def get_default_prefix(cls):
317 317
     def get_queryset(self):
318 318
         # Avoid a circular import.
319 319
         from django.contrib.contenttypes.models import ContentType
320  
-        if self.instance is None:
  320
+        if self.instance is None or self.instance.pk is None:
321 321
             return self.model._default_manager.none()
322 322
         return self.model._default_manager.filter(**{
323 323
             self.ct_field.name: ContentType.objects.get_for_model(self.instance),

0 notes on commit bbe034a

Please sign in to comment.
Something went wrong with that request. Please try again.