Hi all,
I would like change modelChoiseField dinamically:
for example I have two modelChoiseFields:
assigned1Id=forms.ModelChoiceField(queryset=models.User.objects.all().filter(status=True),empty_label="Name")
assigned2Id=forms.ModelChoiceField(queryset=models.Properties.objects.all().filter(status=True),empty_label="Properties")
I would like that:
- if not User is selected, the second ModelChoiceField show all Properties
- if a User is selected in the first modelChoiceField, then the second modelChoiceField add a filter in real time in the queryset.
the same could occurs with some other inputs:
for example if a charInput contains a value, the queryset must filter properties list in the modelChoiceField adding conditions.
it is possible?
many thanks.