Django admin: how to enable add/edit buttons for many-to-many model relationships
21 Jul 2015
It was pretty easy to add an inline for many-to-many model relationship Django admin, like it was mentioned in the Django documentation.
Models:
The trick is that line in admin.py:
But what wasn’t unclear to me is why there is no add/edit buttons on inline items in the Django admin interface, so I couldn’t add or edit any of related model’s objects.
My models.py (simplified):
My admin.py (before fix):
My mistake was that I didn’t register related model OfferGeo in admin.py. After adding admin.site.register(OfferGeo) add/edit buttons appeared.