title: Problem with a new version of django and python code
body: <p>I'm stuck with Django here, I have added the code of views.py and urls.py below. I'm getting the following error:</p>
  
  <p><a href="https://i.stack.imgur.com/TXTVL.png" rel="nofollow noreferrer">This is the error im getting</a></p>
  
  <p>Please look into it and help me if there is any solution to it.
    The error is at the bottom of the image.</p>
  
  <pre><code> views.py 
   from django.shortcuts import render, get_object_or_404, redirect
   from django.contrib.auth.decorators import login_required
   from django.utils import timezone
   from .models import Post, Comment
   from .forms import PostForm, CommentForm
  
   from django.views.generic import (TemplateView,ListView,
                                DetailView,CreateView,
                                UpdateView,DeleteView)
  
   from django.urls import reverse_lazy
     from django.contrib.auth.mixins import LoginRequiredMixin
  
  # Create your views here.
  class AboutView(TemplateView):
    template_name = 'blog/about.html'
  </code></pre>
  
  <p>class PostListView(ListView):
        model = Post</p>
  
  <pre><code>def get_queryset(self):
      return 
    Post.objects.filter(published_date__lte=timezone.now()).order_by('- 
     published_date')
  
  class PostDetailView(DetailView):
      model = Post
  
  
    class CreatePostView(LoginRequiredMixin,CreateView):
     login_url = '/login/'
      redirect_field_name = 'blog/post_detail.html'
  
     form_class = PostForm
  
       model = Post
  
  
     class PostUpdateView(LoginRequiredMixin,UpdateView):
        login_url = '/login/'
        redirect_field_name = 'blog/post_detail.html'
  
      form_class = PostForm
  
       model = Post
  
  
    class PostDeleteView(LoginRequiredMixin,DeleteView):
      model = Post
      success_url = reverse_lazy('post_list')
  
  
    class DraftListView(LoginRequiredMixin,ListView):
      login_url = '/login/'
      redirect_field_name = 'blog/post_draft_list.html'
  
     model = Post
  
     def get_queryset(self):
         return 
    Post.objects.filter(published_date__isnull=True).order_by('created_date')
  
  
  
     @login_required
      def post_publish(request, pk):
      post = get_object_or_404(Post, pk=pk)
      post.publish()
      return redirect('post_detail', pk=pk)
  
    @login_required
      def add_comment_to_post(request, pk):
       post = get_object_or_404(Post, pk=pk)
         if request.method == "POST":
         form = CommentForm(request.POST)
          if form.is_valid():
             comment = form.save(commit=False)
             comment.post = post
             comment.save()
             return redirect('post_detail', pk=post.pk)
  else:
      form = CommentForm()
  return render(request, 'blog/comment_form.html', {'form': form})
  
  
      @login_required
       def comment_approve(request, pk): 
  
       comment = get_object_or_404(Comment, pk=pk)
       comment.approve()
       return redirect('post_detail', pk=comment.post.pk)
  
  
  @login_required
  def comment_remove(request, pk):
      comment = get_object_or_404(Comment, pk=pk)
      post_pk = comment.post.pk
      comment.delete()
      return redirect('post_detail', pk=post_pk)
  ***This is urls.py***
   from django.contrib import admin
   from django.urls import path, include
   from django.contrib.auth import views
  
  urlpatterns = [
      path('', include('blog.urls')),
      path('admin/', admin.site.urls),
      path('accounts/login/', views.login, name='login'),
      path('accounts/logout/', views.logout, name='logout', kwargs= 
      {'next_page': '/'}),
      ]
   from django.urls import path
   from . import views
  
  
   urlpatterns = [
    path('',views.PostListView.as_view(),name='post_list'),
    path('about/',views.AboutView.as_view(),name='about'),
    path('post/&lt;int:pk&gt;', views.PostDetailView.as_view(), name='post_detail'),
    path('post/new/', views.CreatePostView.as_view(), name='post_new'),
    path('post/&lt;int:pk&gt;/edit/', views.PostUpdateView.as_view(), 
  name='post_edit'),
     path('drafts/', views.DraftListView.as_view(), name='post_draft_list'),
     path('post/&lt;int:pk&gt;/remove/', views.PostDeleteView.as_view(), 
  name='post_remove'),
     path('post/&lt;int:pk&gt;/publish/', views.post_publish, name='post_publish'),
     path('post/&lt;int:pk&gt;/comment/', views.add_comment_to_post, 
  name='add_comment_to_post'),
       path('comment/&lt;int:pk&gt;/approve/', views.comment_approve, 
  name='comment_approve'),
     path('comment/&lt;int:pk&gt;/remove/', views.comment_remove, 
    name='comment_remove'),
   ]
  </code></pre>
  
  <p>Please let me know what the mistake is.
  The above files are views.py, urls.py for app as well.
  Look at the image the error has been mentioned at the bottom.</p>