aboutsummaryrefslogtreecommitdiff
path: root/tagging/managers.py
diff options
context:
space:
mode:
Diffstat (limited to 'tagging/managers.py')
-rw-r--r--tagging/managers.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/tagging/managers.py b/tagging/managers.py
index 02cd1c2..d85c260 100644
--- a/tagging/managers.py
+++ b/tagging/managers.py
@@ -1,17 +1,18 @@
"""
-Custom managers for Django models registered with the tagging
-application.
+Custom managers for tagging.
"""
-from django.contrib.contenttypes.models import ContentType
from django.db import models
+from django.contrib.contenttypes.models import ContentType
+
+from tagging.models import Tag
+from tagging.models import TaggedItem
-from tagging.models import Tag, TaggedItem
class ModelTagManager(models.Manager):
"""
A manager for retrieving tags for a particular model.
"""
- def get_query_set(self):
+ def get_queryset(self):
ctype = ContentType.objects.get_for_model(self.model)
return Tag.objects.filter(
items__content_type__pk=ctype.pk).distinct()
@@ -25,6 +26,7 @@ class ModelTagManager(models.Manager):
def usage(self, *args, **kwargs):
return Tag.objects.usage_for_model(self.model, *args, **kwargs)
+
class ModelTaggedItemManager(models.Manager):
"""
A manager for retrieving model instances based on their tags.
@@ -47,6 +49,7 @@ class ModelTaggedItemManager(models.Manager):
else:
return TaggedItem.objects.get_union_by_model(queryset, tags)
+
class TagDescriptor(object):
"""
A descriptor which provides access to a ``ModelTagManager`` for