i have two ModelChoiceFields that are populated with database :
t1=MyModelChoiceField1(queryset=operation_Bancaire.objects.all(),to_field_name='type_tiers',required=False)
t2=MyModelChoiceField2(queryset=operation_Bancaire.objects.all(),required=False)
i need to let the t2
depends on t1
.
for example :
if i choose value1 in t1
, t2
shows only values filtred by the value1 chooses in the first ModelChoiceField t1
i searched a lot about this and found some information that Ajax
would help me to do so. but i'm not sure if it will let me control my ModelChoiceFields as i want specially that my ChoiceFields are populated from database, Because i have never worked with Ajax
.
Any Help please so i can be right oriented to achieve what i need.
Thank You.