django queryset not showing accurate result (building a news app)

I am creating a news app using django. It consists of search by date option. When i choose the date(ex:29-11-2020) and click submit, It should take me to the news of that particular day. When i try the below code instead of showing the details it is giving me a blank page.

from django.shortcuts import render
from .models import *
from django.views.generic.detail import DetailView
from django.views.generic import ListView
   def index(request):
    return render(request,'newspaperapp/index.html')
  class nowlist(ListView):
         model = newsmodel_1
         template_name = 'newspaperapp/index.html'
  class newslist(DetailView):
        model = newsmodel_1
        template_name = 'newspaperapp/home.html'
        context_object_name = 'newspaperapp'
  # search by giving date in index and search date
 class SearchView(ListView):
      model = newsmodel_1
      template_name = 'newspaperapp/search.html'
     context_object_name = 'all_search_results'
  def get_queryset(self):
         result = super(SearchView, self).get_queryset()
        query = self.request.GET.get('search')
        if query:
             postresult = newsmodel_1.objects.filter(date_published__contains=query)
             result = postresult
            result = None
        return result

from django.urls import path
app_name = 'newspaperapp'
from .views import newslist,SearchView,nowlist
from newspaperapp import views
urlpatterns = [
     path('date/',nowlist.as_view(),name = "date"),
     path('<int:pk>',newslist.as_view(),name = "home"),
     path('results/', SearchView.as_view(), name='search'),


<!DOCTYPE html>
<html lang="en" dir="ltr">
  <meta charset="utf-8">
    <p>Today's Paper</p>


<!DOCTYPE html>
<html lang="en" dir="ltr">
   <meta charset="utf-8">
 <!-- this page has search option and different categories of news -->
 <!-- to create search option we write views code and continue -->
 <form class="form-inline my-2 my-lg-0" method="GET" action="{% url 'newspaperapp:search' %}">
 <input class="form-control mr-sm-2" type="date" placeholder="Search" aria-label="Search" 
 <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>

{%for newspaperapp in object_list %}
<li><a href="{%url 'newspaperapp:home' %}">{{newspaperapp.title}}</a>



{% block content %}
{% for newspaperapp in all_search_results %}
    <h3><a href="{%url 'newspaperapp:home' %}"></a></h3>
{% empty %}
    <h2>No results found</h2>
{% endfor %}
{% endblock %}

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload the CAPTCHA.