0👍
When accessing a specific model instance (and not the model’s manager) you access related items with modelname_set
instead of modelname
. For example:
>>> user_detail.roles_set.remove(my_role)
>>> user_detail.roles_set.all()
<QuerySet []>
Docs:
https://docs.djangoproject.com/en/2.1/topics/db/examples/many_to_many/
Source:stackexchange.com