save single groups
This commit is contained in:
parent
d74e4973f9
commit
3f6bb910d8
1 changed files with 1 additions and 0 deletions
|
@ -139,6 +139,7 @@ class EditorFormBase(ModelForm):
|
|||
if field.many_to_many:
|
||||
groups = reduce(operator.or_, (set(value) for name, value in self.cleaned_data.items()
|
||||
if name.startswith('groups_')), set())
|
||||
groups |= set(value for name, value in self.cleaned_data.items() if name.startswith('group_'))
|
||||
groups = tuple((int(val) if val.isdigit() else val) for val in groups)
|
||||
self.instance.groups.set(groups)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue