1👍
✅
As Agent
has ManyToManyField
relation with AgentCategory
.
agentcategory
would contain the list of entries.
you can update its entries by,
agent_cats = AgentCategory.objects.filter(...)
property_selected.agentcategory.clear()
property_selected.agentcategory = agent_cats
property_selected.agentcategory.save()
Source:stackexchange.com