title: update django choice field with database results
body: <p>I am developing an application using django where the UI needs to be updated when user interacts with it. For instance I have a Drop down field where the user selects a drink and submits it then based on that a dropdown with the places that drink is available, price and quantity at each place needs to be displayed. The user will then further submit the form for second process.</p>
  
  <p>From my understanding the Forms in django are pre-defined and I am not able to think of a way using which I could achieve this.</p>
  
  <p>What I could come up was defining a regular form class</p>
  
  <pre><code>class dform(forms.Form):
      SOURCES_CHOICES = (
                (A, 'A'),
                (E, 'E'),
                )
    drink = forms.ChoiceField(choices = SOURCES_CHOICES)
    location = forms.ChoiceField(choices = **GET THIS FROM DATABASE**)
    quantity = forms.ChoiceField(choices = **GET THIS FROM DATABASE**)
    .
    .
    .
  </code></pre>
  
  <p>My view is like,</p>
  
  <pre><code>def getdrink():
     if request.method == 'POST':
        #code for handling form
        drink =  dform.cleaned_data['drink']
        #code to get values from database
  </code></pre>
  
  <p>I have no idea how to generate or populate or append the values i get from the database to the choicefield in my form. I did try looking up on SO but none of the solutions here explained properly how to do it. Also, due to certain requirements I am not using the models. So my database is not at all related to the models.</p>
  
  <p>I am at a total loss Please help me out</p>