Extend the social_auth User model in Django

django, django-socialauth

Solution

I created a custom Manager class as required, and called it `CustomUserManager`.

Here is the code:

class CustomUserManager(models.Manager):
    def create_user(self, username, email):
        return self.model._default_manager.create(username=username)

then I changed my User class to:

class User(models.Model):
    username = models.CharField(max_length=30)
    last_login = models.DateTimeField(blank=True, null=True)
    is_active = models.BooleanField(default=False)
    playedHours = models.FloatField(default = 0)

    objects = CustomUserManager()

    playedSongs = models.ManyToManyField(Song, blank=True, null = True)
    invitedFriends = models.ManyToManyField('self', blank = True, null = True)

def __unicode__(self):
    return self.username

def is_authenticated(self):
    return True    

In my settings.py :

SOCIAL_AUTH_USER_MODEL = 'myappname.User'

Thanks ArgsKwargs for the help :)

Problem

I'm using Django-social-auth for the first time, and it seems that all the new users are registered in the User's model of the social_auth app of my Django website. I have a different model called Users which has some specific data (related to the users activity in the site and relation with other entities) and I want to put the data fetched from users' Facebook profiles (username, profile picture etc) into the Users model that I made myself. is there any way to extend the social_auth Users? EDIT After reading the Django-social-auth documentation, i edited my User class as follow : ``` # User model ``` class User(models.Model): ``` username = models.CharField(max_length=30) last_login = models.DateTimeField(blank=True) is_active = models.BooleanField(default=False) playedHours = models.FloatField(default = 0) userSlug = models.SlugField(unique = True) playedSongs = models.ManyToManyField(Song, blank=True, null = True) invitedFriends = models.ManyToManyField('self', blank = True, null = True) def __unicode__(self): return self.name ``` Also, how can i get the user's profile picture, friends list and so on? I dont understand the mechanism of this. Thanks a lot !

Original source