commit | fc764e708488348fd6bf7f6db09da57b63ee60ce | [log] [tgz] |
---|---|---|
author | Scott Baker <smbaker@gmail.com> | Thu Feb 18 14:28:56 2016 -0800 |
committer | Scott Baker <smbaker@gmail.com> | Thu Feb 18 14:28:56 2016 -0800 |
tree | 93ad8b13d0033fc1144f9eec7d3cafa4146a1a2f | |
parent | b3cbf35af111ab420f27f6cea75e64d2a1c40677 [diff] |
add select_by_content_object
diff --git a/xos/core/models/tag.py b/xos/core/models/tag.py index d774800..76a4e2e 100644 --- a/xos/core/models/tag.py +++ b/xos/core/models/tag.py
@@ -27,6 +27,10 @@ def can_update(self, user): return user.can_update_root() + @classmethod + def select_by_content_object(cls, obj): + return cls.objects.filter(content_type=ContentType.objects.get_for_model(obj), object_id=obj.id) + @staticmethod def select_by_user(user): return Tag.objects.all()