title: Django can't search "method not allowed"
body: <p>im new to django and im currently doing a website for my friend. he wants me to make a system where the users can search the database and the website gives the relevent items according to their serial number.
  i followed a tutorial from the following site: <a href="https://learndjango.com/tutorials/django-search-tutorial" rel="nofollow noreferrer">https://learndjango.com/tutorials/django-search-tutorial</a> to figure out how to do db searchs which helped a lot, but im still having a problem: my search bar works, and the result page also works but it only works when i manually type the query on the searchbar myself (e.x. results/?q=number1). However when i search using the input bar and the submit button it sends me to /results/ page and the page gives this:</p>
  <p>This page isn’t working</p>
  <p>If the problem continues, contact the site owner.</p>
  <p>HTTP ERROR 405</p>
  <p>-when i open up pycharm to see the error in terminal it says:</p>
  <pre><code>Method Not Allowed (POST): /result/
  
  Method Not Allowed: /result/
  
  [27/Oct/2020 20:06:02] &quot;POST /result/ HTTP/1.1&quot; 405 0
  </code></pre>
  <p>here are my codes(python3.7,pycharm) websites/urls:</p>
  <pre><code>from . import views
  from django.urls import path
  from django.contrib.auth import views as auth_views
  
  urlpatterns = [
      path('register/',views.UserFormView.as_view(), name='register'),
      path('login/', auth_views.LoginView.as_view(), name='login'),
      path('', views.IndexViews.as_view(), name='index'),
      path('scan/', views.ScanView.as_view(), name='scan'),
      path('result/', views.SearchResultsView.as_view(), name='result'),
  ]
  </code></pre>
  <p>websites/views:</p>
  <pre><code>class IndexViews(generic.ListView):
      template_name = &quot;websites/index.html&quot;
      context_object_name = &quot;object_list&quot;
  
      def get_queryset(self):
          return Website.objects.all()
  
  
  class ScanView(TemplateView):
      form_class = SerialFrom
      template_name = 'websites/scan.html'
  
  
  class SearchResultsView(ListView):
      model = SerialNumber
      template_name = 'websites/result.html'
  
      def get_queryset(self):  # new
          query = self.request.GET.get('q')
          context = self.get_context_data(object=self.object)
          object_list = SerialNumber.objects.filter(
              Q(number__iexact=query)
          )
          return object_list
  </code></pre>
  <p>scan.html:</p>
  <pre><code> {% extends 'websites/base.html' %}
  {% block albums_active %}active{% endblock %}
  
  {% block body %}
  &lt;head&gt;
      &lt;meta charset=&quot;UTF-8&quot;&gt;
      &lt;title&gt;Scan&lt;/title&gt;
      &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;form class=&quot;box&quot; action=&quot;{% url 'result' %}&quot; method=&quot;POST&quot;&gt;
        &lt;h1&gt;Product Check&lt;/h1&gt;
          &lt;p&gt; Please enter the serial id of your product to check it.&lt;/p&gt;
        {% csrf_token %}
        &lt;input type=&quot;text&quot; name=&quot;q&quot; placeholder=&quot;Serial Number&quot;&gt;
        &lt;input type=&quot;submit&quot; name=&quot;q&quot; placeholder=&quot;Check&quot;&gt;
    &lt;/form&gt;
  &lt;/body&gt;
  {% endblock %}
  </code></pre>
  <p>thank you for taking your time and reading, please help me i really need to do this.</p>