Skip to content

Instantly share code, notes, and snippets.

benjaminlong /
Created Jun 8, 2021 — forked from Grokzen/
Symmetrical ManyToMany Filter Horizontal in Django Admin
# Based on post from:
# Only reposting to avoid loosing it.
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.
Below is an example of how to create a filtered multiple select for the reverse relationship, so that editing entries is as easy as in the forward direction.
### pizza/ ###