Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove some bizzare and unnecesary code.

  • Loading branch information...
commit b98083ce3dfc35a3f3732f4873761a3f78e4194f 1 parent aee9c7b
Alex Gaynor authored
Showing with 1 addition and 4 deletions.
  1. +1 −4 django/contrib/contenttypes/generic.py
5 django/contrib/contenttypes/generic.py
View
@@ -18,6 +18,7 @@
from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import smart_text
+
class GenericForeignKey(object):
"""
Provides a generic relation to any object through content-type/object-id
@@ -51,9 +52,6 @@ def instance_pre_init(self, signal, sender, args, kwargs, **_kwargs):
kwargs[self.fk_field] = value._get_pk_val()
def get_content_type(self, obj=None, id=None, using=None):
- # Convenience function using get_model avoids a circular import when
- # using this model
- ContentType = get_model("contenttypes", "contenttype")
if obj:
return ContentType.objects.db_manager(obj._state.db).get_for_model(obj)
elif id:
@@ -215,7 +213,6 @@ def extra_filters(self, pieces, pos, negate):
"""
if negate:
return []
- ContentType = get_model("contenttypes", "contenttype")
content_type = ContentType.objects.get_for_model(self.model)
prefix = "__".join(pieces[:pos + 1])
return [("%s__%s" % (prefix, self.content_type_field_name),
Please sign in to comment.
Something went wrong with that request. Please try again.