1👍
✅
Using Secator’s suggestion as part of the solution, I ended up just monkey-patching the Tag
model itself where needed instead of the Tag.objects
.
This being the final code:
from tagging.models import TagManager, Tag
import tagging
class MyTagManager(TagManager):
def update_tags(self, obj, tag_names):
# My actions
return super(MyTagManager, self).update_tags(obj, tag_names)
def add_tag(self, obj, tag_name):
# My actions
return super(MyTagManager, self).add_tag(obj, tag_name)
class MyTag(Tag):
objects = MyTagManager()
class Meta:
proxy = True
tagging.models.Tag = MyTag
tagging.fields.Tag = MyTag
2👍
Use proxy model with the different manager:
class MyTag(Tag):
objects = MyTagManager()
class Meta:
proxy = True
- [Django]-Use Django-Storages with IAM Instance Profiles
- [Django]-How do I run makemessages so it includes some apps that are outside the Django project?
- [Django]-Django URLs without function in views
Source:stackexchange.com