How to protect my django content from directly accessing by url

I am using queryset filter in my Blog page. Right now it’s only displaying blog those passed queryset filter. If I change any blog status = “pending” then it will hide from my blog page but user can still see the blog by accessing url. How to prevent them to see my “pending” status content? any idea?

I find out this solution. It will protect my content from others user by directly access by url. Except author if anyone try to access this page, it will return 404 page.

class BlogListMyAccount(LoginRequiredMixin,DetailView):

      raise_exception = True

      model = Blog

      template_name = 'my-account-blog.html'

      

      def get_object(self):

          obj = super(BlogListMyAccount,self).get_object()

          if obj.author  != self.request.user: 

              raise PermissionDenied      # It will return 404 page if author id and user id is not same  

          return obj