Note that there are some explanatory texts on larger screens.

plurals
  1. POdjango-facebook not inserting facebook data to the models
    text
    copied!<p>I have installed django-facebook in my Working application but it is creating a lots of problems. I have followed the installation of django-facebook <a href="http://django-facebook.readthedocs.org/en/latest/#installation" rel="nofollow">here</a> but I have not been able to implement it properly.</p> <p>In facebook/example when I try to connect to facebook, it prompts the user for facebook credentials but it's not able to redirect to the next page as I am getting following error:</p> <blockquote> <p>user or profile didn't have attribute facebook_id</p> </blockquote> <p>I did manage.py syncdb but facebook attributes remain 'null' in DB after connecting to facebook in facebook/example.</p> <p>I have added following to my code as in the documentation:</p> <p>account/model.py</p> <pre><code>from django.db import models from django.contrib.auth.models import User from django.db.models.signals import post_save from django_facebook.models import FacebookProfileModel class User_info(FacebookProfileModel): user_id = models.ForeignKey(User) dob = models.DateField(blank=True, null=True) contact = models.IntegerField(max_length=20, blank=True, null=True) avatar = models.ImageField(upload_to='user_images', default='user_images/root.jpeg', null=True, blank=True) def create_facebook_profile(sender, instance, created, **kwargs): if created: User_info.objects.create(user_id=instance) post_save.connect(create_facebook_profile, sender=User) </code></pre> <p>settings.py</p> <pre><code>INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'account', 'django_facebook', ) TEMPLATE_CONTEXT_PROCESSORS =( 'django.contrib.auth.context_processors.auth', 'django.core.context_processors.debug', 'django.core.context_processors.i18n', 'django.core.context_processors.media', 'django.core.context_processors.static', 'django.core.context_processors.tz', 'django.core.context_processors.request', 'django_facebook.context_processors.facebook', ) AUTHENTICATION_BACKENDS = ( 'django_facebook.auth_backends.FacebookBackend', 'django.contrib.auth.backends.ModelBackend',) FACEBOOK_APP_ID = 'xxxxxxxxxxxxx' FACEBOOK_APP_SECRET = 'xxxxxxxxxxxxxx' </code></pre> <p>urls.py</p> <pre><code>urlpatterns = patterns('', url(r'^accounts/login/$', login, {'template_name': 'login.html'}), url(r'^accounts/logout/$', logout, {'next_page': '/accounts/login/'}, name='auth_logout',), url(r'^accounts/signup/$', account.views.register, name='signup'), url(r'^facebook/', include('django_facebook.urls')), ) </code></pre> <p>Please help me on this. Thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload