Skip to content

Instantly share code, notes, and snippets.

@Mortal
Mortal / foo.py
Last active September 5, 2017 09:14 — forked from Grokzen/Symmetrical ManyToMany Filter Horizontal in Django Admin.py
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from:
# https://snipt.net/chrisdpratt/symmetrical-manytomany-filter-horizontal-in-django-admin/#L-26
"""
When adding a many-to-many (m2m) relationship in Django, you can use a nice
filter-style multiple select widget to manage entries. However, Django only
lets you edit the m2m relationship this way on the forward model. The only
built-in method in Django to edit the reverse relationship in the admin is
through an InlineModelAdmin.