title: Django redirect user before logout
body: <p>I want to redirect the user to a page where he can see some statistic datas before logout. So what exactly I want is when he clicks on the logout button then first to show him that page ex: <code>localhost:8000/statistic/ </code>and after if he clicked on another button on that page then logout him.
  Now I am using Django's LogoutView:</p>
  <pre><code>class LogoutView(SuccessURLAllowedHostsMixin, TemplateView):
      &quot;&quot;&quot;
      Log out the user and display the 'You are logged out' message.
      &quot;&quot;&quot;
      next_page = None
      redirect_field_name = REDIRECT_FIELD_NAME
      template_name = 'registration/logged_out.html'
      extra_context = None
  
      @method_decorator(never_cache)
      def dispatch(self, request, *args, **kwargs):
          auth_logout(request)
          next_page = self.get_next_page()
          if next_page:
              # Redirect to this page until the session has been cleared.
              return HttpResponseRedirect(next_page)
          return super().dispatch(request, *args, **kwargs)
  
      def post(self, request, *args, **kwargs):
          &quot;&quot;&quot;Logout may be done via POST.&quot;&quot;&quot;
          return self.get(request, *args, **kwargs)
  
      def get_next_page(self):
          if self.next_page is not None:
              next_page = resolve_url(self.next_page)
          elif settings.LOGOUT_REDIRECT_URL:
              next_page = resolve_url(settings.LOGOUT_REDIRECT_URL)
          else:
              next_page = self.next_page
  
          if (self.redirect_field_name in self.request.POST or
                  self.redirect_field_name in self.request.GET):
              next_page = self.request.POST.get(
                  self.redirect_field_name,
                  self.request.GET.get(self.redirect_field_name)
              )
              url_is_safe = is_safe_url(
                  url=next_page,
                  allowed_hosts=self.get_success_url_allowed_hosts(),
                  require_https=self.request.is_secure(),
              )
              # Security check -- Ensure the user-originating redirection URL is
              # safe.
              if not url_is_safe:
                  next_page = self.request.path
          return next_page
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          current_site = get_current_site(self.request)
          context.update({
              'site': current_site,
              'site_name': current_site.name,
              'title': _('Logged out'),
              **(self.extra_context or {})
          })
          return context
  </code></pre>
  <p>I think I have to override this View in my code, but I am a little bit confused about the steps, witch method do I have to override, how it should be.</p>