forked from 0x2620/pandora
new api calls: getGroups/addGroup/removeGroup
This commit is contained in:
parent
5a87d6b8dd
commit
3cdb0e23cc
3 changed files with 71 additions and 3 deletions
|
|
@ -230,7 +230,8 @@ class Item(models.Model):
|
|||
if isinstance(groups, list):
|
||||
groups = filter(lambda g: g.strip(), groups)
|
||||
groups = [ox.escape_html(g) for g in groups]
|
||||
self.groups.exclude(name__in=groups).delete()
|
||||
for g in self.groups.exclude(name__in=groups):
|
||||
self.groups.remove(g)
|
||||
current_groups = [g.name for g in self.groups.all()]
|
||||
for g in filter(lambda g: g not in current_groups, groups):
|
||||
group, created = Group.objects.get_or_create(name=g)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue