Skip to content

Instantly share code, notes, and snippets.

@loic
Created January 22, 2014 15:28
Show Gist options
  • Save loic/8560713 to your computer and use it in GitHub Desktop.
Save loic/8560713 to your computer and use it in GitHub Desktop.
diff --git a/django/db/models/manager.py b/django/db/models/manager.py
index 4a080e9..24f9d95 100644
--- a/django/db/models/manager.py
+++ b/django/db/models/manager.py
@@ -196,6 +196,14 @@ Manager = BaseManager.from_queryset(QuerySet, class_name='Manager')
Manager.__module__ = 'django.db.models.manager'
+class CustomQuerySet(QuerySet):
+ pass
+
+CustomManager = Manager.from_queryset(CustomQuerySet, class_name='CustomManager')
+
+print CustomManager.__module__
+print CustomQuerySet.as_manager().__module__
+
class ManagerDescriptor(object):
# This class ensures managers aren't accessible via model instances.
# For example, Poll.objects works, but poll_obj.objects raises AttributeError.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment