[Django]-Delete ManyToManyField in Django from admin page and on button click

3πŸ‘

βœ…

In ManyToMany relationship field there is no delete functionality we need to use remove an instance for that or in order to clear the field value we need to use clear link

say for your case

our_desire_skill = skills.objects.filter(skill=search_skill)
desiner_user = Designer.objects.get(user=our_desire_user)
desiner_user.skills.remove(our_desire_skill)

If you want to change ManyToManyFields from admin page need to make sure that field is like raw_id_fields link Then you can able to update your ManyToManyField store value from admin site.

πŸ‘€Shakil

Leave a comment