title: Django form post doesn't save to DB
body: <p>The form I made on Django doesn't save any data, I think it's a validation issue but I can't find where the problem is - whenever I click on the &quot;submit&quot; button the page is refreshed but no new entries are created - when I do that from Django Admin it works fine.</p>
  <p>I'm a complete beginner and this is my very first Django project.</p>
  <p><strong>models.py</strong></p>
  <pre><code>class Utente(models.Model):
      id_utente = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=True)
      gen_utente = models.CharField(max_length=7, choices=GEN_CHOICES)
      age_utente = models.CharField(max_length=2)
      con_utente = CountryField()
      per_utente = models.CharField(max_length=18, choices=PER_CHOICES)
      pres_utente = models.CharField(max_length=11, choices=PRES_CHOICES)
      doc_utente = models.CharField(max_length=29, choices=DOC_CHOICES)
      vis_utente = models.CharField(max_length=10, choices=VIS_CHOICES)
      san_utente = models.CharField(max_length=17, choices=SAN_CHOICES)
      nnb_utente = models.CharField(max_length=5, choices=NNB_CHOICES)
      unnb_utente = models.CharField(max_length=8, choices=UNNB_CHOICES)
      va_utente = models.CharField(max_length=12, choices=VA_CHOICES)
      tem_utente = models.DateField()
      res_utente = models.CharField(max_length=5000)
  
      def __str__(self):
          return f'Utente n: {self.id_utente} del {self.tem_utente}'
  </code></pre>
  <p><strong>forms.py</strong> <em>(I've removed the labels)</em></p>
  <pre><code>class UtenteForm(forms.ModelForm):
      class Meta:
          model = Utente
          fields = ['id_utente', 'gen_utente', 'age_utente', 'con_utente', 'per_utente', 'pres_utente', 'doc_utente', 'vis_utente', 'san_utente', 'nnb_utente', 'unnb_utente', 'vac_utente', 'tem_utente', 'res_utente']
          labels = {
              'id_utente': '.......',
              'gen_utente': '.......',
              'age_utente': '.......',
              'con_utente': '.......',
              'per_utente': '.......',
              'pres_utente': '.......',
              'doc_utente': '.......',
              'vis_utente': '.......',
              'san_utente': '.......',
              'nnb_utente': '.......',
              'unnb_utente': '.......',
              'vac_utente': '.......',
              'tem_utente': '.......',
              'res_utente': '.......'
          }
          widgets = {
              'id_utente': forms.TextInput(attrs={'class': 'form-control', 'disabled': True}),
              'gen_utente': forms.Select(choices=SESSO_CHOICES, attrs={'class': 'form-control'}),
              'age_utente': forms.TextInput(attrs={'class': 'form-control', 'pattern': '([0-9]{2})'}),
              'con_utente': CountrySelectWidget(attrs={'class': 'form-control'}),
              'per_utente': forms.Select(choices=PERMANENZA_CHOICES, attrs={'class': 'form-control'}),
              'pres_utente': forms.Select(choices=PRESENZA_CHOICES, attrs={'class': 'form-control'}),
              'doc_utente': forms.Select(choices=DOCUMENTI_CHOICES, attrs={'class': 'form-control'}),
              'vis_utente': forms.Select(choices=VISITEPREG_CHOICES, attrs={'class': 'form-control'}),
              'san_utente': forms.Select(choices=DOCSANITARI_CHOICES, attrs={'class': 'form-control'}),
              'nnb_utente': forms.Select(choices=MMG_CHOICES, attrs={'class': 'form-control'}),
              'unnb_utente': forms.Select(choices=USOMMG_CHOICES, attrs={'class': 'form-control'}),
              'vac_utente': forms.Select(choices=VACCINOCOVID_CHOICES, attrs={'class': 'form-control'}),
              'vis_utente': forms.DateInput(attrs={'class': 'form-control', 'type': 'date'}),
              'res_utente': forms.Textarea(attrs={'class': 'form-control', 'rows':'3'})
          }
  </code></pre>
  <p><strong>views.py</strong></p>
  <pre><code># Add new utente
  def aggiungi_utente(request):
      if request.method == 'POST':
          form = UtenteForm(request.POST)
          if form.is_valid():
              new_id_utente = form.cleaned_data ['id_utente']
              new_gen_utente = form.cleaned_data ['gen_utente']
              new_age_utente = form.cleaned_data ['age_utente']
              new_con_utente = form.cleaned_data ['con_utente']
              new_per_utente = form.cleaned_data ['per_utente']
              new_pres_utente = form.cleaned_data ['pres_utente']
              new_doc_utente = form.cleaned_data ['doc_utente']
              new_vis_utente = form.cleaned_data ['vis_utente']
              new_san_utente = form.cleaned_data ['san_utente']
              new_nnb_utente = form.cleaned_data ['nnb_utente']
              new_usnnb_utente = form.cleaned_data ['unnb_utente']
              new_vac_utente = form.cleaned_data ['vac_utente']
              new_tem_utente = form.cleaned_data ['tem_utente']
              new_res_utente = form.cleaned_data ['res_utente']
  
  
              new_utente = Utente(
                  id_utente = new_id_utente,
                  gen_utente = new_gen_utente,
                  age_utente = new_age_utente,
                  con_utente = new_con_utente,
                  per_utente = new_per_utente,
                  pres_utente = new_pres_utente,
                  doc_utente = new_doc_utente,
                  vis_utente = new_vis_utente,
                  san_utente = new_san_utente,
                  nnb_utente = new_nnb_utente,
                  unnb_utente = new_unnb_utente,
                  vac_utente = new_vac_utente,
                  tem_utente = new_tem_utente,
                  res_utente = new_res_utente
              )
              new_utente.save()
              return render(request, 'utenti/add-utenti.html', {
                  'form': UtenteForm(),
                  'success': True
              })
      else:
          form = UtenteForm()
      return render(request, 'utenti/add-utenti.html', {
          'form': UtenteForm()
      })
  
  # Modify and edit utente
  def modifica_utenti(request, pk):
      if request.method == 'POST':
          utente= Utente.objects.get(pk=pk)
          form = UtenteForm(request.POST, instance=utente)
          if form.is_valid():
              form.save()
              return render(request, 'utenti/mod-utenti.html',{
                  'form': form,
                  'success': True
              })
      else:
          utente = Utente.objects.get(pk=pk)
          form = UtenteForm(instance=utente)
      return render(request, 'utenti/mod-utenti.html', {
          'form': form
      })
  
  # To delete utente
  def delete_utente(request, pk):
      if request.method == 'POST':
          utente = Utente.objects.get(pk=pk)
          utente.delete()
      return HttpResponseRedirect(reverse('utenti'))
  
  # View utente
  def view_utente(request, pk):
      utente = Utente.objects.get(pk=pk)
      return HttpResponseRedirect(reverse('index'))
  </code></pre>
  <p><strong>template file</strong></p>
  <pre><code>{% extends &quot;utenti/base.html&quot; %}
  
  {% block body %}
      &lt;h3 class=&quot;text-center m-4&quot;&gt;Add new utente&lt;/h3&gt;
      {% if success %}
          &lt;div class=&quot;alert alert-success&quot; role=&quot;alert&quot;&gt;
              Added successfully.
              &lt;a href=&quot;{% url 'utenti' %}&quot; class=&quot;alert-link&quot;&gt;Go to the list.&lt;/a&gt;
          &lt;/div&gt;
      {% else %}
          &lt;div class=&quot;row justify-content-center&quot;&gt;
              &lt;div class=&quot;col-6&quot;&gt;
                  &lt;div class=&quot;card bg-light mb-3&quot;&gt;
                      &lt;div class=&quot;card-header&quot;&gt;
                          &lt;i class=&quot;fa-solid fa-address-card fa-lg&quot;&gt;&lt;/i&gt; Create utente
                      &lt;/div&gt;
                      &lt;div class=&quot;card-body&quot;&gt;
                          &lt;form action=&quot;{% url 'aggiungi-utenti' %}&quot; method=&quot;POST&quot;&gt;
                              {% csrf_token %}
                              {{ form.as_p }}
                              &lt;button type=&quot;submit&quot; class=&quot;btn btn-primary&quot;&gt;Add&lt;/button&gt;
                              &lt;a href=&quot;{% url 'utenti' %}&quot; class=&quot;btn btn-secondary&quot;&gt;Cancel&lt;/a&gt;
                          &lt;/form&gt;
                      &lt;/div&gt;
                    &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      {% endif %}
  {% endblock %}
  </code></pre>