1👍
The Django admin can do this already, wherever you have a ForeignKey
field in the ModelForm
the admin site will show the + button and popup selector functionality you want.
Here is an article about how to achieve the same thing in your own views outside the admin:
http://sontek.net/blog/detail/implementing-djangos-admin-interface-pop-ups
…author has released the code as a reusable Django app:
https://github.com/sontek/django-tekextensions
Here is another app which does more but also includes the functionality you’re looking for:
https://django-autocomplete-light.readthedocs.org/en/latest/addanother.html
Source:stackexchange.com