title: Django: Accessing request in forms.py clean function
body: <p>Hi Stackoverflow people, </p>
  
  <p>In my clean function in forms.py, I would like to save automatically some information in a session variable. However, I do not seem to get access to the request variable.</p>
  
  <p>All examples for handing over the request variable are based on function based views, but here I am using a class based view.</p>
  
  <p><strong>My forms.py:</strong></p>
  
  <pre><code>from django import forms
  from item.models import Item
  
  class CreateItemForm(forms.ModelForm):
      class Meta:
          model = Item
          fields = ('name', 'description')
  
      def __init__(self, request, *args, **kwargs):
          self.request = request
          super(CreateItemForm, self).__init__(*args, **kwargs)
  
      def clean(self):
          cleaned_data = super(CreateItemForm, self).clean()
          if cleaned_data.get("address"):
              self.request.session['name'] = cleaned_data.get("name") 
          else:
              raise forms.ValidationError(_('Oops, can\'t find location.'))
          return self.cleaned_data
  </code></pre>
  
  <p><strong>My views.py:</strong></p>
  
  <pre><code>from django.views.generic.edit import FormView
  from item.forms import CreateItemForm
  
  class ItemCreate(FormView):
      form_class = CreateItemForm 
      template_name = 'item/item_create.html' 
      success_url = 'http://www.google.com'
  </code></pre>
  
  <p><strong>What is the best way to hand over the <code>request</code> variable from the views.py to forms.py?</strong></p>
  
  <p>Thank you for your answer.</p>