Several forms on a page
I'm relatively new to django and trying to create a page, where I ask questions and allow users to give two answer. So I want to display a list of questions, and fields for two guesses below. I tried to make using form, but I can't save or validate the data I get from those forms.
Below if my relevant code.

**From models.py**

   

     class Subject(models.Model):
        subject = models.FloatField(verbose_name='ID')
        
    class SubjectForm(forms.Form):
        subject = forms.FloatField()
    
    class General(models.Model):
        question = models.CharField(max_length=400)
        answer = models.FloatField()
    
    class Guess(models.Model):
        general = models.ForeignKey(General)
        subject = models.ForeignKey(Subject)
        lower = models.FloatField('lower boundary')
        upper = models.FloatField('upper boundary')
        
    class GuessForm(forms.Form):
        lower = forms.FloatField()
        upper = forms.FloatField()

**From views.py**

    def questions(request):
    if request.method == 'POST': # If answers were submitted
        for question in all_questions:
            form = GuessForm()
                if form.is_valid():
                    lower = request.POST.get('lower','')
                    upper = request.POST.get('upper','')
                    new_guess = Guess(pk = 'question',
                                  subject = subject,
                                  lower = lower,
                                  upper = upper)
                    new_quess.save()
            return HttpResponseRedirect('/general_knowledge/questions/thanks/')
        else:
            form = GuessForm()
        csrfContext = RequestContext(request,{'form': form})
        
    return render_to_response('general_knowledge/question_form.html',
                              {'all_questions': all_questions},
                              context_instance=RequestContext(request))


**From template**

    {% for question in all_questions %}
    	<form action="" method="post">{% csrf_token %}
    		<ol>
    		<p><LI> {{ question.question }}.</p>
    		<label for="lower">Lower boundary:</label><input type="text" name="lower">
    		{{ form.lower.errors }}
    		<label for="upper">Upper boundary: </label><input type="text" name="upper">
    		{{ form.upper.errors }}
    		</ol>
    	</form>
    {% endfor %}
    <input type="submit" value="Submit" />
Several forms on a page
===

I'm relatively new to django and trying to create a page, where I ask questions and allow users to give two answer. So I want to display a list of questions, and fields for two guesses below. I tried to make using form, but I can't save or validate the data I get from those forms.
Below if my relevant code.

**From models.py**

   

     class Subject(models.Model):
        subject = models.FloatField(verbose_name='ID')
        
    class SubjectForm(forms.Form):
        subject = forms.FloatField()
    
    class General(models.Model):
        question = models.CharField(max_length=400)
        answer = models.FloatField()
    
    class Guess(models.Model):
        general = models.ForeignKey(General)
        subject = models.ForeignKey(Subject)
        lower = models.FloatField('lower boundary')
        upper = models.FloatField('upper boundary')
        
    class GuessForm(forms.Form):
        lower = forms.FloatField()
        upper = forms.FloatField()

**From views.py**

    def questions(request):
    if request.method == 'POST': # If answers were submitted
        for question in all_questions:
            form = GuessForm()
                if form.is_valid():
                    lower = request.POST.get('lower','')
                    upper = request.POST.get('upper','')
                    new_guess = Guess(pk = 'question',
                                  subject = subject,
                                  lower = lower,
                                  upper = upper)
                    new_quess.save()
            return HttpResponseRedirect('/general_knowledge/questions/thanks/')
        else:
            form = GuessForm()
        csrfContext = RequestContext(request,{'form': form})
        
    return render_to_response('general_knowledge/question_form.html',
                              {'all_questions': all_questions},
                              context_instance=RequestContext(request))


**From template**

    {% for question in all_questions %}
    	<form action="" method="post">{% csrf_token %}
    		<ol>
    		<p><LI> {{ question.question }}.</p>
    		<label for="lower">Lower boundary:</label><input type="text" name="lower">
    		{{ form.lower.errors }}
    		<label for="upper">Upper boundary: </label><input type="text" name="upper">
    		{{ form.upper.errors }}
    		</ol>
    	</form>
    {% endfor %}
    <input type="submit" value="Submit" />