diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py index 0504592ebb..c294f74500 100644 --- a/django/contrib/contenttypes/generic.py +++ b/django/contrib/contenttypes/generic.py @@ -59,7 +59,7 @@ class GenericForeignKey(object): def __get__(self, instance, instance_type=None): if instance is None: - raise AttributeError, u"%s must be accessed via instance" % self.name + return self try: return getattr(instance, self.cache_attr) @@ -183,7 +183,7 @@ class ReverseGenericRelatedObjectsDescriptor(object): def __get__(self, instance, instance_type=None): if instance is None: - raise AttributeError, "Manager must be accessed via instance" + return self # This import is done here to avoid circular import importing this module from django.contrib.contenttypes.models import ContentType