title: Django: How to provide context into a FormView get() method (also using request param)
body: <p>I'm trying to provide some additional context into the get() method in my FormView. I need get() because I need to run some logic first, check for a potential redirect. I also need access to the request object (because I need to check session data). Can't figure out how to do it. Simplified code below..</p>
  
  <p><strong>Attempt 1:</strong></p>
  
  <pre><code>class LoginView(FormView):
     template_name = 'members/login.html'
     form_class = LoginForm
  
     def get(self, request):
        # check if to redirect
        if self.request.session.get('user'):
           return redirect('/dashboard/')
  
        # render page with extra context
        else:
           context = super(LoginView, self).get(request)
           context['message'] = self.request.session['message']
           return context
  </code></pre>
  
  <p>No errors, but context does not come through in the template.</p>
  
  <p><strong>Attempt 2:</strong></p>
  
  <pre><code>class LoginView(FormView):
     template_name = 'members/login.html'
     form_class = LoginForm
  
     def get_context_data(self, request, **kwargs):
        # check if to redirect
        if self.request.session.get('user'):
           return redirect('/dashboard/')
  
        # render page with extra context
        else:
           context = super(LoginView, self).get_context_data(**kwargs)
           context['message'] = self.request.session['message']
           return context
  </code></pre>
  
  <p>Getting <code>TypeError: get_context_data() takes exactly 2 arguments (1 given)</code></p>
  
  <p><em>P.S. This work relates to a workaround Django's buggy messages middleware which seems to be working locally flawlessly but on live (Heroku) is not 100% reliable, renders on some pages only. Ugh, frustration setting in...</em></p>