title: Unable to delete the data from mysql table which is fetched from a form in HTML using Django
body: <p>I am want to: 
  1. save data from a HTML form to MySQL
  2. delete data from mySQL which is entered through HTML form.</p>
  
  <p>The save functionality is working. While there is error in delete functionality.</p>
  
  <p>Model.py</p>
  
  <pre><code>from django.db import models
  
  # Create your models here.
  class info_needed(models.Model):
      id = models.IntegerField(primary_key=True)
      name = models.CharField(max_length=200)
      surname = models.CharField(max_length=200)
      email = models.CharField(max_length=200)
  
      def __str__(self):
          return self.name
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code># Create your views here.
  from django.shortcuts import render
  from django.http import HttpResponse
  
  from .models import info_needed
  
  def index(request):
      return render(request,'userdata/index.html')
  
  def message(request):
      if request.method == 'POST':
          fname = request.POST.get("fname")
          lname = request.POST.get("lname")
          mail = request.POST.get("mail")
          action = request.POST.get("submit_button")
          action1 = request.POST.get("delete_button")
          p = info_needed(name = fname , surname = lname, email = mail)
          print("name", fname)
          print("action", action)
          print("action2", action1)
          if action == "Submit":
              p.save()
          elif action1 == "Delete":
  
              p.delete()
          else:
              return HttpResponse("Wrong Action Provided")
  
      return(HttpResponse("Thank you for submitting your details"))
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from django.urls import path
  
  from . import views
  
  urlpatterns = [
      path('',views.index, name = 'index'),
      path('submit/', views.message, name = 'submit'),
  ]
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;My Page&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="{% url 'submit' %}" method="post" enctype="multipart/form-data"&gt;
      {% csrf_token %}
      {{ form }}
    &lt;label for="fname"&gt;Name:&lt;/label&gt;
    &lt;input type="text" id="fname" name="fname"&gt;&lt;br&gt;&lt;br&gt;
    &lt;label for="lname"&gt;Surname:&lt;/label&gt;
    &lt;input type="text" id="lname" name="lname"&gt;&lt;br&gt;&lt;br&gt;
    &lt;label for="mail"&gt;E-Mail:&lt;/label&gt;
    &lt;input type="text" id="mail" name="mail"&gt;&lt;br&gt;&lt;br&gt;
      &lt;label for="submit_button"&gt;Save&lt;/label&gt;
      &lt;input type="radio"  name="submit_button" id="submit_button" value="Submit"&gt;
      &lt;label for="delete_button"&gt;Delete&lt;/label&gt;
    &lt;input type="radio" name="delete_button" id="delete_button" value="Delete"&gt;
      &lt;input type="submit", value="Submit"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Error while deleting:</p>
  
  <pre><code>AssertionError at /userdata/submit/
  info_needed object can't be deleted because its id attribute is set to None.
  </code></pre>
  
  <p>The primary id is automoatically genenrated, how to delete the row entry in mysql where the name, surname, and email matches?</p>