Facebook Connect: collecting user data using django profiles and django-socialregistration

Either my Google search completely left me, or there was almost no documentation / tutorials for django-socialregistration . Sorry, because this seems like a good app. Thanks to some trial errors, I managed to get it mainly on my site.

My question is, using django-socialregistration , how can I request permission for the full username, current city and date of birth and save it in my UserProfile table (this is my AUTH_PROFILE_MODULE for django profiles) in Django when registering? Also, how can I post to a custom wall from Django after connecting?

Currently, when I click the Connect to Facebook button, a facebook connection is created, a new Django user is created, and the user is logged in with that Django account. However, UserProfile is not created and facebook profile data is not saved.

Any facebook connects gurus there to help ponies Django fly on Facebookland?

Setup:
- Django 1.2.1
- Python 2.5.2
- django-socialregistration 0.4.2
- django-registration 0.7
- django-profiles 0.2

alt text
"Good sir, could you help me find the magical Facebookland?"

+7
django facebook registration user-profile
source share
3 answers

In facebook_js.html you need to customize the following line by uncommenting the elements you need to get from FB:

FB.login(handleResponse/*,{perms:'publish_stream,sms,offline_access,email,read_stream,status_update,etc'}*/); 

Then in FacebookMiddleware you can extract this data from fb_user , for example:

  facebook.GraphAPI(fb_user['access_token']).get_object('me') 
+8
source share

FWIW, I just found this moderately useful nugget from the author of the application buried in the "Problems" section on github:

question from "tolano":

I have a profile model associated with users, and every time a user is created, a profile must also be created. Should we create a new custom view for this?

I find several problems because the documentation is poor. Thank you very much.

reply from "flashingpumpkin":

Yes. Ideally, you overwrite the customization view with your own. An easier way to customize what is done when the user is created is to submit the user form to the customization view. You will do this by overriding the standard URL.

+3
source share

Here is another matching nugget (source: http://github.com/flashingpumpkin/django-socialregistration/issues/closed#issue/7 ). Enough of these, and this page will become the de facto django-socialregistration documentation;)

question from "girasquid":

Maybe I just missed something, but I'm stuck here - is there a way to connect accounts on other sites to an existing user?

For example, I already signed up for the Really Awesome Website, so I don’t need to register again, but I would like to connect my Facebook and Twitter accounts so that I can log in with them.

Is there any way to do this already? If not ... how would I do that?

reply from "flashingpumpkin":

Yes there is. Just use the same template tags for Facebook Connect as for registration. Depending on whether the user has already been registered or not, he will only create a FacebookProfile object and associate it with an existing user - or he will create both User objects and a FacebookProfile object.

Look at here:
http://github.com/flashingpumpkin/django-socialregistration/blob/master/socialregistration/templates/socialregistration/facebook_button.html and

http://github.com/flashingpumpkin/django-socialregistration/blob/master/socialregistration/templatetags/facebook_tags.py

+1
source share

All Articles