title: Getting an error while using Django Model Form in views.py
body: <p>In my models.py</p>
  
  <pre><code> class Alert(models.Model):
  
      user = models.CharField(max_length=30, blank=True)
      a = models.IntegerField(blank=True)
      def __unicode__(self):
          return "'%s' at %s" % (self.user)
  </code></pre>
  
  <p>In My forms.py:</p>
  
  <pre><code> class AlertForm(forms.ModelForm):
      class Meta:
          model=Alert
          fields = ('a','user')
          widgets = {
              'user': forms.HiddenInput()
          }
  
  AlertCountFormset = modelformset_factory(Alert,
                                          form = AlertForm)
  </code></pre>
  
  <p>In my views.py:</p>
  
  <pre><code>def profile_setting(request, slug):
  if request.method == 'GET':
      form = AlertForm(request.POST)
      if form.is_valid():
          alert_form = form.save(commit=False)
          alert_form.user = request.user.username
          alert_form.save() # Here i am getting the error
          return HttpResponseRedirect('/user/list')
  
  extra_context = {
      'form': AlertForm()
  }
  return direct_to_template(request,'users/profile_setting.html',
                            extra_context)
  </code></pre>
  
  <p>I am trying to fill the Django model Form but i am getting following <code>error</code> where i had put the comment:</p>
  
  <pre><code>events_alertcount.a may not be NULL
  </code></pre>
  
  <p>What is this? Even after putting the<code>null=True</code> in the field of <code>a</code> it shows an same error. Is that something wrong with my <code>forms.py or models.py</code>?</p>