commit | 3d798d37ea35cf91924ac59db430d628f8d6a5d1 | [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 | 08b99df86c1124ba370357747d025395139781fa | |
parent | 247d697e1ebdff52809f865c676c8c86d1d0ac17 [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()