'Django ForeignKey replace dropdown with Popup
A very stupid question, but I just could not figure out how to it simple.
In my model (says Measurements) I have a ForeignKey to link the device that we want to add Measurements (device_link = models.ForeignKey(Device, null=True, blank=True,on_delete=models.PROTECT))
I made a Form to create a new Measurements and globally it works well and straightforward.
But to choose the Device, Django use a select field via Dropdown menu. So if we have a lot of devices it could be very difficult to choose the desired device.
So, I'd like to replace dropdown select menu with a link that open popup window with a list of devices. User choose the device, click and then get back to the form inserting selected device.
Sounds simple, but I could not find how to do it in Django.
What I have tried already :
- django-addanother
It works very well and do almost that I want... but not exactly, it allow to Add new Device instead of choose.
- django-autocomplete-light
Seems to be very close to that I want, but I could not find any popup example.
- django-select2
I could not understand if it could do that I want. I tried to make a little test and could not found out how to use it.
So... Are there any way to do it in simple and light way ?
I found a similar question here : Django admin, override dropdown with selection from popup window
But in my case I'm not in Django Admin situation, but just my simple app.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
