[Question] Is it possible to create dependent/ chained filter fields? #1431
Replies: 6 comments
-
I have the exact same question and cant figure it out aswell. For sure it would require some ajax to the backend when a filter has been selected that influences the other fields. Alternativly I tried to manipulate the html with javascript - but that didnt work out very well. Some coverage would be very appreciated, maybe more people have this problem too. |
Beta Was this translation helpful? Give feedback.
-
I found another djang app that could do that, but forgot the name now, but ended up opted to just use javascript to make requests and update the filter. |
Beta Was this translation helpful? Give feedback.
-
You can create dependent fields by using a DjangoSelect2 widget and specifying the dependent fields inside the form.
|
Beta Was this translation helpful? Give feedback.
-
can you tell me more about Django select2 I have work with that I got confused isn't there anyway ? |
Beta Was this translation helpful? Give feedback.
-
Django Select2 is a very useful library as it uses Select2 to render a select inside a form. It enhances the posibilities of a select, for exemple, by filtering results depending on another select value. Specifying dependent_fields={'address_province': 'province'} the queryset of the field is filtered by the address_province selected value, excluding the other results. Another advantage of DjangoSelect2 is that it paginates the options of a select reducing form rendering time. It also adds a browser to search inside the options. You can find more information here. |
Beta Was this translation helpful? Give feedback.
-
can you show me code i cant understand django select @GerardoGa |
Beta Was this translation helpful? Give feedback.
-
sorry pressed enter without adding description
I want to create a filter with where the fields should filter themselves, for example a list of cities on one filed tat will be filtered by the state selected.
I looked the previous issues and can't figure it out how to implement said filter....
Beta Was this translation helpful? Give feedback.
All reactions