Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #10274 -- Fixed an embarrassing mistake in BaseGenericInlineFor…

…mSet.get_queryset. Thanks Zak Johnson for the report and akaihola for the patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@9886 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 4bd24474c02a6f3c70e8111ac262fabf2fc5f454 1 parent 13d3d9d
@brosner brosner authored
View
2  django/contrib/contenttypes/generic.py
@@ -307,7 +307,7 @@ def get_queryset(self):
# Avoid a circular import.
from django.contrib.contenttypes.models import ContentType
if self.instance is None:
- return self.model._default_manager.empty()
+ return self.model._default_manager.none()
return self.model._default_manager.filter(**{
self.ct_field.name: ContentType.objects.get_for_model(self.instance),
self.ct_fk_field.name: self.instance.pk,
View
5 tests/modeltests/generic_relations/models.py
@@ -219,6 +219,11 @@ def __unicode__(self):
>>> from django.contrib.contenttypes.generic import generic_inlineformset_factory
>>> GenericFormSet = generic_inlineformset_factory(TaggedItem, extra=1)
+>>> formset = GenericFormSet()
+>>> for form in formset.forms:
+... print form.as_p()
+<p><label for="id_generic_relations-taggeditem-content_type-object_id-0-tag">Tag:</label> <input id="id_generic_relations-taggeditem-content_type-object_id-0-tag" type="text" name="generic_relations-taggeditem-content_type-object_id-0-tag" maxlength="50" /></p>
+<p><label for="id_generic_relations-taggeditem-content_type-object_id-0-DELETE">Delete:</label> <input type="checkbox" name="generic_relations-taggeditem-content_type-object_id-0-DELETE" id="id_generic_relations-taggeditem-content_type-object_id-0-DELETE" /><input type="hidden" name="generic_relations-taggeditem-content_type-object_id-0-id" id="id_generic_relations-taggeditem-content_type-object_id-0-id" /></p>
>>> formset = GenericFormSet(instance=Animal())
>>> for form in formset.forms:
... print form.as_p()
Please sign in to comment.
Something went wrong with that request. Please try again.