How to filter ModelMultipleChoiceField based on another field?

Depending on the form below, I would like to know if there is a way (or a plugin) to use the tipo_indicador field to filter the indicator field:

tipo_indicador = forms.ModelChoiceField(
    queryset=TipoIndicador.objects.all(),
    label=u'Tipo de indicador',
    required=False,
)

indicadores = forms.ModelMultipleChoiceField(
    label= _(u'Indicadores'),
    required=False,
    queryset=Indicador.objects.all(),
    widget=admin_widgets.FilteredSelectMultiple(verbose_name=_(u'indicadores'), is_stacked=False)

)

+4
source share

Source: https://habr.com/ru/post/1694647/


All Articles