It's been explicitly written in Django-facebook that they recommend it to be used with Userena:
We recommend using Django Userena. It seems easier to work with than Django Registration. Both are supported and good packages though. To use django userena simply point to the userena compatability layer.
AUTH_PROFILE_MODULE = 'django_facebook.FacebookProfile'
My question comes from AUTH_PROFILE_MODULE = 'django_facebook.FacebookProfile'
part.
I have developed my own UserProfile in Userena and also inherited some system Actors like Student and Tutors based upon their own needs. so my setting is something like this:
AUTH_PROFILE_MODULE = 'profiles.UserProfile'
Within the django-facebook there is also an awesome example project that has written for mixing userena and django-facebook settings. But my problem still exists..
Should I replace my own code with facebook's one ??
This is my code :
from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.db.models import permalink
from userena.models import UserenaBaseProfile
from courses.models import Course
class UserProfile(UserenaBaseProfile):
user = models.OneToOneField(User, unique=True, verbose_name=_('user'), related_name='user_profile')
department = models.ForeignKey('Department' , null = True , blank = True , related_name=_('user'))
name = models.CharField(max_length = 100)
birthday = models.DateField()
def __unicode__(self):
return self.name
class Student(UserProfile):
courses = models.ManyToManyField(Course , null = True, blank = True, related_name = _('student'))
Thanks beforehand ..
Just add the fields required for Facebook to your existing profile.
class UserProfile(UserenaBaseProfile, FacebookProfileModel): ....
(https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance)