title: using custom user model with django-allauth gives error Cannot resolve keyword 'username' into field. Choices are: activityhistory, app, ....,
body: <p>I was trying to integrate django-allauth, and I tried to use custom user model. As stated <a href="https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#a-full-example" rel="nofollow">here</a>, I created my model</p>
  
  <pre><code>class Client(AbstractBaseUser):
      fname = models.CharField(max_length=50)
      lname = models.CharField(max_length=50)
      email = models.EmailField(max_length=150, unique=True, db_index=True)
      created_at = models.DateTimeField(auto_now_add=True)
      state_choices = (
          (0, 'Pending'),
          (1, 'Active'),
          (2, 'Deleted'),
          (3, 'Banned'),
      )
      state = models.SmallIntegerField(choices=state_choices, default=1, editable=False)
      objects = ClientManager()
      USERNAME_FIELD = 'email'
      REQUIRED_FIELDS = ['fname', 'lname']
      def save(self, *args, **kwargs):
          #########
      def get_short_name(self):
          return self.fname
  
      def get_full_name(self):
          return '%s %s' % (self.fname, self.lname)
  
      def has_perm(self, perm, obj=None):
          ###########
  
      def has_module_perms(self, app_label):
          ###########
  
      @property
      def is_staff(self):
          ###########
  </code></pre>
  
  <p>And the manager</p>
  
  <pre><code>class ClientManager(BaseUserManager):
      def create_user(self, fname, lname, email, created_at, state):
          user = self.model(fname=fname, lname=lname, email=email, created_at=created_at, state=state)
          return user
  
      def create_superuser(self, fname, lname, email, created_at, state):
          user = self.create_user(fname=fname, lname=lname, email=email, created_at=created_at, state=state)
          user.is_team_player = True
          user.save()
          return user
  </code></pre>
  
  <p>Now, for the <code>admin.py</code> I did</p>
  
  <pre><code>class UserCreationForm(forms.ModelForm):
      #A form for creating new users
      class Meta:
          model = models.Client
          fields = ('fname', 'lname', 'email')
  
  
  class UserChangeForm(forms.ModelForm):
      #A form for updating users
      class Meta:
          model = models.Client
          fields = ['fname', 'lname', 'email', 'is_admin']
  
  class ClientAdmin(UserAdmin):
      # The forms to add and change user instances
      form = UserChangeForm
      add_form = UserCreationForm
  
      list_display = ('email', 'is_admin')
      list_filter = ('is_admin',)
  
      fieldsets = (
      (None, {'fields': ('email', )}),
      ('Personal info', {'fields': ('fname', 'lname')}),
      ('Permissions', {'fields': ('is_admin',)}),
      )  
  
      add_fieldsets = (
      (None, {
          'classes': ('wide',),
          'fields': ('email', 'fname', 'lname')}
      ),
  )
  
      search_fields = ('email',)
      ordering = ('email',)
      filter_horizontal = ()
  
  
  
  
  admin.site.unregister(models.Client)
  admin.site.register(models.Client, ClientAdmin)
  admin.site.unregister(Group)
  </code></pre>
  
  <p>In the <code>settings.py</code> I added <code>AUTH_USER_MODEL = 'app.Client'</code></p>
  
  <p>Now when I go to <code>/admin</code> it gives me the error</p>
  
  <pre><code>ImproperlyConfigured at /admin
  Cannot resolve keyword 'username' into field. Choices are: activityhistory, app, created_at, email, emailaddress, fname, id, is_active, is_admin, last_login, lname, logentry, password, socialaccount, state, testdevice
  </code></pre>
  
  <p>The stack trace tells me that since it treats <code>email</code> as username, and I use <code>username</code> and <code>password</code> for logging in, it gives me this error. Can't I make django ignore this restriction for admin only, or can I change the login mechanism for admin to use email rather than username?</p>
  
  <p>I am trying to use <code>django-allauth</code> for letting a user sign-in through google or signup using his email and password. But its been a tough ride for me till now. If anybody has done that before or knows how to do it easily, pointing me to references would be great.</p>