Provide way to add an item during "Selecting a ForeignKey"

70 views
Skip to first unread message

guettli

unread,
Feb 27, 2016, 8:28:27 AM2/27/16
to Django users

I use django-select2 for easy ForeignKey picking. Works nice.


But how can I add a new item in the ForeignKey table?


I would like to have a big [+] button and then a dialog should open.


AFAIK django-select2 does not help here. Is there a different library which can help here?


The result should look like this "create user" example: https://jqueryui.com/dialog/#modal-form


I don't care how the pop-up works.


Via ajax, browser pop-up, or like in django admin, ...


It should work and be re-usable. I don't want to invent this common pattern again and again.

guettli

unread,
Mar 2, 2016, 7:12:02 AM3/2/16
to Django users
I found that django-autocomplete-light supports "Add another popup outside the admin":

http://django-autocomplete-light.readthedocs.org/en/latest/addanother.html

This is exactly what I was looking for :-)

guettli

unread,
Mar 2, 2016, 7:16:59 AM3/2/16
to Django users
Just for the records: "add another" is one compared feature in this comparison grid: https://www.djangopackages.com/grids/g/auto-complete/
Reply all
Reply to author
Forward
0 new messages