title: How can I redirect to user requested url after login - Django loginrequiredmixin
body: <p>I am trying to limit the access for a view using <strong>Django LoginRequiredMixin</strong>. If the user is not logged in it will redirect to the login page. But the problem is that after login it is not redirecting to the user typed url instead it goes to the default page?</p>
  
  <p>For example user tries to login to the page <strong>site/site-create</strong>. If the user is not logged in it goes to the login page. After the login it goes to the default page of login.Here I want to redirect the user to <strong>site/site-create</strong> page.Example view</p>
  
  <pre><code>class CreateSite(LoginRequiredMixin, CreateView):
      model = Site
      fields = ['name','site_category','description',]
  </code></pre>
  
  <p>Login/views.py</p>
  
  <pre><code>class LoginViewClass(FormView):
      """
      Provides the ability to login as a user with a username and password
      """
      form_class = AuthenticationForm
      template_name = 'login/login_view_class.html'
  
      def get_context_data(self, **kwargs):
         context = super(LoginViewClass, self).get_context_data(**kwargs)
         create_all_menus(ALL_MENUS)
         return context
  
      def post(self, request):
          username = self.request.POST['username']
          password = self.request.POST['password']
          user = authenticate(username=username, password=password)
  </code></pre>
  
  <p><strong>Edit--></strong> login views.py added
   How can I do that? Thank You</p>