title: python social auth with django custom user model
body: <p>I'm using <code>python-social-auth</code> (not django-social-auth because it's depreciated) for authentication in Django REST backend applciation with <code>Custom User Model</code> described below.</p>
  
  <pre><code>from django.contrib.auth.models import AbstractBaseUser, UserManager
  
  class User(AbstractBaseUser):
  
      class Gender():
          MALE = 0
          FEMALE = 1
          UNKNOWN = 2
          CHOICES = [(MALE, 'Male'), (FEMALE, 'Female'), (UNKNOWN, 'Unknown')]
  
      username = models.CharField(_('username'), max_length=30, unique=True,
          help_text=_('Required. 30 characters or fewer. Letters, digits and '
                      '@/./+/-/_ only.'),
          validators=[
              validators.RegexValidator(r'^[\w.@+-]+$', _('Enter a valid username.'), 'invalid')
          ])
      first_name = models.CharField(max_length=30, blank=True)
      last_name = models.CharField(max_length=30, blank=True)
      email = models.EmailField(blank=True)
      is_staff = models.BooleanField(default=False)
      is_active = models.BooleanField(_('active'), default=True)
      date_joined = models.DateTimeField(default=timezone.now)
  
      gender = models.IntegerField(choices=Gender.CHOICES, default=Gender.UNKNOWN)
      birthday = models.DateField(default=timezone.now)
      facebook_id = models.CharField(max_length=30, blank=True)
  
      USERNAME_FIELD = 'username'
      REQUIRED_FIELDS = ['email']
      objects = UserManager()
  
      def __unicode__(self):
          return self.username
  
      def save(self, *args, **kwargs):
          """ ensure instance has usable password when created """
          if not self.pk and self.has_usable_password() is False:
              self.set_password(self.password)
  
          super(User, self).save(*args, **kwargs)
  </code></pre>
  
  <p>Notice that I don't implement a custom <code>UserManager</code>. Social auth pipline is also straightforward.</p>
  
  <pre><code>AUTHENTICATION_BACKENDS = (
        'social.backends.facebook.FacebookOAuth2',
        'django.contrib.auth.backends.ModelBackend',
    )
  
  SOCIAL_AUTH_PIPELINE = (
      'social.pipeline.social_auth.social_details',
      'social.pipeline.social_auth.social_uid',
      'social.pipeline.social_auth.auth_allowed',
      'social.pipeline.social_auth.social_user',
      'social.pipeline.user.get_username',
      'social.pipeline.social_auth.associate_by_email',
      'social.pipeline.user.create_user',
      'social.pipeline.social_auth.associate_user',
      'social.pipeline.social_auth.load_extra_data',
      'social.pipeline.user.user_details'
  )
  </code></pre>
  
  <p>However, when I try to authenticate with Facebook, it gives an error as below</p>
  
  <p><code>TypeError at /api-token/login/facebook/
  'is_superuser' is an invalid keyword argument for this function</code></p>
  
  <p>The problem is, probably, <code>python-social-auth</code> try to use django's own User instead of custom User Model that I defined.
  In <code>django-social-auth</code> there is a setting's parameter like <code>SOCIAL_AUTH_USER_MODEL</code> but I couldn't find any way to do it in <code>python-social-auth</code></p>
  
  <p>How can I make it possible to use my custom user model in python-social-auth?</p>