title: Django - Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'NoneType'>`
body: <p>Why i am getting this error? <strong>Expected a <code>Response</code>, <code>HttpResponse</code> or <code>HttpStreamingResponse</code> to be returned from the view, but received a <code>&lt;class 'NoneType'&gt;</code></strong> how do i solve this ?</p>
  
  <p>my Homepage/api/views.py</p>
  
  <pre><code>from rest_framework import status
  from rest_framework.response import Response
  from rest_framework.decorators import api_view
  
  from Homepage.models import EducationLevel
  from Homepage.api.serializers import EducationLevelSerializer
  
  @api_view(['GET', ])
  def api_detail_educationlevel(request):
  
    try:
      education = EducationLevel.objects.all()
    except EducationLevel.DoesNotExist:
      return Response(status=status.HTTP_400_BAD_REQUEST)
  
      if request.method == "GET":
        serializer = EducationLevelSerializer(education)
        return Response(serializer.data)
  </code></pre>
  
  <p>Homepage/api/serializers.py</p>
  
  <pre><code>from rest_framework import serializers
  from Homepage.models import EducationLevel
  class EducationLevelSerializer(serializers.HyperlinkedModelSerializer):
      class Meta:
          model = EducationLevel
          field = ('Sequence', 'Description', 'Status')
  </code></pre>
  
  <p>my Homepage/api/urls.py</p>
  
  <pre><code>from django.urls import path
  from Homepage.api.views import api_detail_educationlevel
  
  app_name='educationlevel'
  
  urlpatterns = [
    path('', api_detail_educationlevel, name="detail"),
  ]
  </code></pre>
  
  <p>my main urls.py</p>
  
  <pre><code>urlpatterns = [
  
      path('api/educationlevel/', include('Homepage.api.urls', 'educationlevel_api')),
  ]
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>when i tried this</p>
  
  <pre><code>def api_detail_educationlevel(request, slug):
        try:
          education = EducationLevel.objects.get(id=slug)
        except EducationLevel.DoesNotExist:
          return Response(status=status.HTTP_400_BAD_REQUEST)
  </code></pre>
  
  <p>i get this error</p>
  
  <p><a href="https://i.stack.imgur.com/EOval.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EOval.png" alt="enter image description here"></a></p>