1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Fixed Role m2m binding so it even works all the time

This commit is contained in:
Akita Noek 2016-03-21 21:09:22 -04:00
parent 4bb2f27fe5
commit ec851492d6

View File

@ -155,9 +155,9 @@ class ImplicitRoleField(models.ForeignKey):
for pk in pk_set:
obj = model.objects.get(pk=pk)
if action == 'post_add':
getattr(instance, self.name).children.add(getattr(obj, field_attr))
getattr(instance, field_attr).children.add(getattr(obj, self.name))
if action == 'pre_remove':
getattr(instance, self.name).children.remove(getattr(obj, field_attr))
getattr(instance, field_attr).children.remove(getattr(obj, self.name))
else:
for pk in pk_set: