I’m using the pyfacebook module for Django to implement facebook Connect for one of my sites, I’m not using a local User object because I only want to use Facebook for login.
I understand that I can’t access the request object from the save method on a Django form, so how would I access the facebook object that the provided middleware gives you?
I want to attach the users facebook UID to an object being created from a form, I could add it as a hidden field to the form but then people could just change it to make it appear that a question came from someone else.
What is the best way to pass in this uid to the save() method?
The correct way to do this is to use an instance of the object you’re trying to save, like this:
Do this in your view, NOT in the save() method of your object.
Watch out if any of the fields are required though, you’ll have to specify them in the instance objector calling form.save will throw an exception.