Hi,
i need i new widget for Select fields.
I have in my models 2 classes:
class address(models.Model):
lastname = models.CharField(max_length=255, default="", )
firstname = models.CharField(max_length=255, default="", blank=True, null=True)
and a second class:
class emailaddress(models.Model):
address_link = models.ForeignKey(Address, on_delete=models.CASCADE, blank=False, null=False, default=None,)
Now i want define
in my forms.py:
class Emailsform(forms.ModelForm):
class Meta:
model = emailaddress
fields = ["address_link"]
widgets = {'address_link':multiselectfilterview()}
Now in frontend i want a normal multiselect field. When user click on this input field then a modal open with a Adress view. This Adress view should get all adresses with ajax. In this Adress View Paging and Filtering must be possible. In this modal in left column checkboxes are shown and user can select multiple adresses with this checkbox. In Modal View there must be a submit button and when user click on submit all adresses which is checked is submit to original multiselect field.
This widget must be modular so i can use it for another foreingkey relations.
Have anyone a idea how i can implement such a widget or have already done this?
Regards