It is necessary to add to the html form so that from the SELECT or OPTION tag the infa is transferred to a specific field form.CharFiled . It is necessary in order to make the logic in the SELECT . As some OPTION may not be available depending on the value in Product(models.Model)

So if item_1 = False, item_2 = True , then the following is in html:

  <select> {% if item_1 %} <option>Item1</option> {% endif %} {% if item_2 %} <option>Item2</option> {% endif %} </select> 

The user will only select item_2 and need this value to be written in the usual form.CharField field. That is, assign either SELECT or OPTION to {{ form.items_example }}

    1 answer 1

    Add the name attribute to the tag, the value of which will be equal to the name of the CharField field in your model. Then, when submitting the form, the junga can parse the POST request correctly and do everything the way you want: <select name="kefal"> {% if item_1 %} <option>Item1</option> {% endif %} {% if item_2 %} <option>Item2</option> {% endif %} </select> Where the field looks like this: kefal = forms.CharField()