mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Added the ability to clear tags by category.
This commit is contained in:
parent
4491110dc1
commit
1c010b455a
1 changed files with 9 additions and 3 deletions
|
|
@ -149,9 +149,15 @@ class TagHandler(object):
|
|||
getattr(self.obj, self._m2m_fieldname).remove(tagobj[0])
|
||||
self._recache()
|
||||
|
||||
def clear(self):
|
||||
"Remove all tags from the handler"
|
||||
getattr(self.obj, self._m2m_fieldname).clear()
|
||||
def clear(self, category=None):
|
||||
"""
|
||||
Remove all tags from the handle. Optionally, only remove those within
|
||||
a certain category.
|
||||
"""
|
||||
if not category:
|
||||
getattr(self.obj, self._m2m_fieldname).clear()
|
||||
else:
|
||||
getattr(self.obj, self._m2m_fieldname).filter(db_category=category).delete()
|
||||
self._recache()
|
||||
|
||||
def all(self, category=None, return_key_and_category=False):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue