title: warning :data truncated for column 'username' at row 1 when using database mysql with django
body: <p>I am getting the above mentioned warning</p>
  
  <blockquote>
    <blockquote>
      <blockquote>
        <p>data truncated for column 'username' at row 1</p>
      </blockquote>
    </blockquote>
  </blockquote>
  
  <p>I am getting this for my model <strong>"suserprofile" with "username" as my first listed field</strong> in the model</p>
  
  <p>I checked max_length option which is not the problem for me,
  if I change the order of my fields in the my model(changed "email_id" field to the first in list of the model),then I am getting the warning replacing 'username' with whatever field I mentioned first(in this case email_id) in the model.</p>
  
  <p>I am not getting this warning when running syncdb but getting warning only when I am trying to save a new object in my model("suserprofile") in my views.py file using django by actually running the local browser.
  I am not understanding why is it happenning</p>
  
  <p>edit:</p>
  
  <p><strong>my model:</strong></p>
  
  <pre><code>class SUserProfile(models.Model):
      email_id            = models.EmailField(max_length=30)
      username      = models.CharField(max_length=50,blank=True)  
      first_name          = models.CharField(max_length=30)
      last_name           = models.CharField(max_length=30)
  </code></pre>
  
  <p><strong>my view</strong></p>
  
  <pre><code>from django.allauth.models import SocialAccount
  def profileview(request):
      user=request.user   
      if user.is_authenticated:
          a=SocialAccount.objects.filter(user=user)   
          try:    
              f=a.get(provider='facebook')
          except:
              f=None
      if f:
          fusername=f.get_provider_account    
          fdata=f.extra_data 
          ffirst_name=fdata['first_name']     
          flast_name=fdata['last_name']
          femail=fdata.get('email')
          try: 
              old_user=SUserProfile.objects.get(email_id=femail)
          except:
              new_user=SUserProfile( 
              username=fusername,
              email_id=femail,
              first_name=ffirst_name,
              last_name=flast_name,)
              new_user.save() 
  </code></pre>
  
  <p><strong>warning details I'm getting when running the browser:</strong></p>
  
  <pre><code> Exception Type:    Warning
  
   Exception Value:   Data truncated for column 'email_id' at row 1
  
   Exception Location:/usr/lib/python2.7/dist-packages/MySQLdb/cursors.py in _warning_check, line 92
  
  Traceback Switch to copy-and-paste view
  
  usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in get_response
  
         response = callback(request, *callback_args, **callback_kwargs)
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py in _wrapped_view
  
         return view_func(request, *args, **kwargs)
  
  ...
  
  ▶ Local vars
  /home/varun/webops/mysite/allauth/account/views.py in profileview
  
         new_user.save()
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save
  
  self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save_base
  
  result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/db/models/manager.py in _insert
  
         return insert_query(self.model, objs, fields, **kwargs)
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/db/models/query.py in insert_query
  
      return query.get_compiler(using=using).execute_sql(return_id)
  
  ...
  
   ▶ Local vars
   /usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py in execute_sql
  
      cursor.execute(sql, params)
  
  ...
  
   ▶ Local vars
   /usr/local/lib/python2.7/dist-packages/django/db/backends/util.py in execute
  
      return self.cursor.execute(sql, params)
  
  ...
  
  ▶ Local vars
  /usr/local/lib/python2.7/dist-packages/django/db/backends/mysql/base.py in execute
  
      return self.cursor.execute(query, args)
  
  ...
  
  ▶ Local vars
  /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py in execute
  
      if not self._defer_warnings: self._warning_check()
  
  ...
  
  ▶ Local vars
  /usr/lib/python2.7/dist-packages/MySQLdb/cursors.py in _warning_check
  
       warn(w[-1], self.Warning, 3)
  
  ...
  
  ▶ Local vars 
  </code></pre>