Find user's Facebook friends who are also registered users on my site in Django
Find friend button is inefficient indeed, I would search the database just once at user registration.
I'm developing a Django site that has as a feature its own social network. Essentially, the site stores connections between users. I want users to be able to import their pre-existing Facebook connections (friends) to my site, so that they will automatically be connected to their existing Facebook friends who are users on my site.
The way I envision doing this is by allowing users to login with Facebook (probably with something like django-socialauth), and store the user's Facebook ID in the database. Then, each time a user clicks the "find friends from Facebook" button, I could query the Facebook API to see if any of my existing users are their friends. What's the best way to do this? I could use FQL and get a list of their friend's Facebook IDs, and then check that against my users', but that seems really inefficient at scale. Is there any way to do this without running through each of my users, one by one, and checking whether their Facebook ID is in the user's friends list?
Thanks.