title: django check user groups in forms
body: <p>I have a form defined from a model class.
  Depending from the user group of the logged in user, some fields should be read-only.
  I tried with the 'request.user.groups.values_list'. But this is not working, error message: 'global name 'request' is not defined'</p>
  
  <p>class gwagen1Form(forms.ModelForm):</p>
  
  <pre><code>class Meta:
      model = gwagen1
      fields = ('gwnummer', 'wk_auftrag', 'model', 'vorbesitzer', 'typ', 'verwendung',
                'kennzeichen', 'hsn_tsn', 'km_stand', 'repartur_kosten')
  
  
      localized_fields = '__all__'
  
  
  # Default value for salesman
  def __init__(self, *args, **kwargs):
      super(gwagen1Form, self).__init__(*args, **kwargs)
      self.fields["verk_num"].initial = benutzer.objects.get(flag_default=True)
  
      gr = request.user.groups.values_list('name', flat=True)
      if gr:   
          self.fields['km_stand'].widget.attrs['readonly'] = True
  </code></pre>