Django POST not entering data into SQLLiteDB -form not valid

I am trying to get my post data into my SQL database but I just get forms not valid:

questions.html (Trimed since the same code is repeated for question2 and question3 replace question1 in code

  <form action = "" method = "POST">
  {% csrf_token %}
  <div>
    <p class="t1">Top management demonstrates business continuity leadership and commitment</p>
  </div>
  <table class="center">
  <thead>
  <tr>
    <th>Risk Area</th>
    <th>Not Sure</th>
    <th> 1 - Not at All</th> 
    <th> 2 - Somewhat</th>
    <th>3 - Average</th>
    <th>4 - Above Average</th>
    <th>5 - Outstanding</th>
  </tr>
  </thead>
  <tbody>
        <td colspan="7">{{ topic.0 }}</td>

        {% for question in questions1 %}
                <tr>
                  <td class="question">{{question}}</td>
                      {% for n in nchoices %}
                          {% if n == 0 %} 
                          <td>
                          
                            <input name= {{question.id}} type="radio" value={{ n }}  id="{{name}}" /><lable> Not Sure</lable>
                      
                          </td>
                          {% else %}
                          <td>
                          
                          <input name={{question.id}} type="radio" value={{ n }}  id="{{name}}" /><lable> {{n}}</lable>
                          </td>
                          {% endif %}
                      {% endfor %}
                  </tr>
            {% endfor%}

    {% endfor%}
    </table>

    </table>
    
    <h4>Enter any comments about your responses to the questions</h4>
    <textarea name="{{ textname }}">"Enter Comments Here"</textarea >
    
    <input type="submit">
</form>

models.py

class Answer(models.Model):
    value = models.IntegerField(null = True)
    name = models.CharField(max_length=20, null = True)
    # q_id = models.CharField(max_length=10, default="XX")  # USed foreignkey instead
    question = models.ForeignKey(
        Question, on_delete=models.CASCADE, null  = True,)

forms.py

class AnswerForm(forms.ModelForm):
   class Meta:
      model = Answer
      fields = ["name", "value"]

views.py

if request.method == "POST":
            results=dict(request.POST) # get POST data from form
            form = AnswerForm(request.POST)
            if form.is_valid():
                form.save()
                areaheader=Area_Header.objects.all()
                area=Area.objects.all() # get names of areas for header
                results=dict(request.POST) # get POST data from form
                score_comments=create_list(results) #Get tuple with (score, comments)
                score=score_comments[0]
                comments=score_comments[1]
                results_color = score_color(score)
                print(score, results_color,comments, question_answers)
                print("Form valid")
                context = {
                    "shade": results_color,
                    "area": area, 
                    "areaheader": areaheader, 
                }
                return render(request, "leadershipresults.html", context)
            else:
                print("Form not valid")
                form = AnswerForm(request.POST)
                print(form.errors)
                return render(request, "questions.html", context)
else:
            print("No POST Request")
            return render(request, "questions.html")

I was expecting to get answers populated with 10 answers and comments with comments, and the CSRF token ignored.

I printed the post results and it appeared all the data is coming across.

Error:

Form not valid
<ul class="errorlist"><li>name<ul class="errorlist"><li>This field is required.</li></ul></li><li>value<ul class="errorlist"><li>This field is required.</li></ul></li></ul>
Back to Top