for u in Users.objects.all():
for g in u.group.all():
if g not in Groups.objects.filter(domain__user=u.id):
u.group.filter(id=g.id).delete()
How do I delete the entries in relationship table. In this case I have a many to many relationship between Groups and Users. The delete statement in the above code deletes the group from the Groups table. I just want to delete the relationship between the user and the group from the Users_group table. How do I do this.
Thanks