title: ValueError at /edit/3 The view main_panel.views.edit didn't return an HttpResponse object. It returned None instead
body: <p>I'm trying to add an edit button to my project and gives me an error.</p>
  
  <p>The following code is my <em>views.py</em> file.</p>
  
  <pre><code>def edit(request, list_id):
  if request.method == 'POST':
      item = List.objects.get(pk=list_id)
      form = ListForm(request.POST or None, instance=item)
  
      if form.is_valid():
          form.save()
          return redirect('home')
  else:
      item = List.objects.get(pk=list_id)
      return render(request, 'main_panel/edit.html', {'item': item})
  </code></pre>
  
  <p>This is my <em>edit.html</em>,</p>
  
  <pre><code>{% extends 'main_panel/base.html' %}
  
  {% block content %}
  
   {% if item  %}
  &lt;form class="form-inline my-2 my-lg-0" method="POST"&gt;
         {% csrf_token %}
  
  
      &lt;input type="search" value="{{ item.name }}" name="name"&gt;
      &lt;input type="search" value="{{ item.choice_field }}" name="choice_field"&gt;
      &lt;input type="search" value="{{ item.product }}" name="product"&gt;
      &lt;input type="search" value="{{ item.avans }}" name="avans"&gt;
      &lt;input type="search" value="{{ item.total_price }}" name="total_price"&gt;
      &lt;input type="search" value="{{ item.status }}" name="status"&gt;
  
      &lt;button type="submit"&gt;Kaydet&lt;/button&gt;
  &lt;/form&gt;
  {% endif %}
  {% endblock %}
  </code></pre>
  
  <p>This is my <em>urls.py</em>,</p>
  
  <pre><code>from django.urls import path
  from . import views
  
  urlpatterns = [
    path('', views.home, name='home'),
    path('add/', views.add, name='add'),
    path('delete/&lt;list_id&gt;', views.delete, name='delete'),
    path('edit/&lt;list_id&gt;', views.edit, name='edit')
  ]
  </code></pre>
  
  <p>which gives me the following error:</p>
  
  <blockquote>
    <p>ValueError at /edit/3
        The view main_panel.views.edit didn't return an HttpResponse object.
        It returned None instead.</p>
  </blockquote>
  
  <p>When I click the <em>submit</em> button after I edit my data it gives me the error. Appreciate any help. Thank you.</p>