Suppose we have these Django models:
class Band(models.Model):
name = models.CharField(max_length=256, default="Eagles of Death Metal")
class Song(models.Model):
band = models.ForeignKey(Band)
When using an administrator to manage these models, the field bandis associated with the Widgetone displayed by Django as an selecthtml element .
Django admin also adds a green plus icon next to it select, when clicked, a popup window opens where the user is provided Formto add a new range. When you click the save button in this pop-up window, the new group name is saved in the database and is automatically assigned to the value select.
We rely on some javascript that will run every time the value changes select. He is currently listening to the event of the changespecified item, which works fine when the user clicks the value directly in the menu offered select.
Unfortunately, when this one is selectpopulated through the Admin popup function, it seems that the event is changenot fired for select, since our callback is not executed, even if the value of the element is actually changed.
Is there any other event that we can listen to get the same behavior than when the user clicks a value directly from the list?