fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make-tags: script to generate a TAGS file in project root. The tags are acquired...
[wolnelektury.git]
/
apps
/
newtagging
/
managers.py
diff --git
a/apps/newtagging/managers.py
b/apps/newtagging/managers.py
index
1dbcb29
..
3107070
100644
(file)
--- a/
apps/newtagging/managers.py
+++ b/
apps/newtagging/managers.py
@@
-1,3
+1,4
@@
+# -*- coding: utf-8 -*-
"""
Custom managers for Django models registered with the tagging
application.
"""
Custom managers for Django models registered with the tagging
application.
@@
-13,15
+14,15
@@
class ModelTagManager(models.Manager):
def __init__(self, tag_model):
super(ModelTagManager, self).__init__()
self.tag_model = tag_model
def __init__(self, tag_model):
super(ModelTagManager, self).__init__()
self.tag_model = tag_model
-
+
def get_query_set(self):
content_type = ContentType.objects.get_for_model(self.model)
return self.tag_model.objects.filter(
items__content_type__pk=content_type.pk).distinct()
def get_query_set(self):
content_type = ContentType.objects.get_for_model(self.model)
return self.tag_model.objects.filter(
items__content_type__pk=content_type.pk).distinct()
-
+
def related(self, tags, *args, **kwargs):
return self.tag_model.objects.related_for_model(tags, self.model, *args, **kwargs)
def related(self, tags, *args, **kwargs):
return self.tag_model.objects.related_for_model(tags, self.model, *args, **kwargs)
-
+
def usage(self, *args, **kwargs):
return self.tag_model.objects.usage_for_model(self.model, *args, **kwargs)
def usage(self, *args, **kwargs):
return self.tag_model.objects.usage_for_model(self.model, *args, **kwargs)
@@
-61,7
+62,7
@@
class TagDescriptor(object):
"""
def __init__(self, tag_model):
self.tag_model = tag_model
"""
def __init__(self, tag_model):
self.tag_model = tag_model
-
+
def __get__(self, instance, owner):
if not instance:
tag_manager = ModelTagManager(self.tag_model)
def __get__(self, instance, owner):
if not instance:
tag_manager = ModelTagManager(self.tag_model)