Answer the question
In order to leave comments, you need to log in
How to set a value in a django form so that it doesn't get reset after an update?
There is a search form by country
class CityChoiceForm(forms.ModelForm):
country_from = forms.ModelChoiceField(
queryset=Country.objects.all(),
label="Страна",
required=False,
widget=ModelSelect2Widget(
model=Country,
search_fields=['title__icontains'],
)
)
<div class="select_wrap">
{{form.country_from}}
</div>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question