Metadata-Version: 1.0
Name: django-facebook
Version: 3.5.0
Summary: Facebook open graph API client in python. Enables django applications to register users using facebook.
Fixes issues with the official but unsupported Facebook python-sdk. Enables mobile facebook authentication.
Canvas page authentication for facebook applications. FQL access via the server side api.

Home-page: http://github.com/tschellenbach/Django-facebook
Author: Thierry Schellenbach
Author-email: thierryschellenbach@gmail.com
License: Copyright (c) Thierry Schellenbach

 (http://www.mellowmorning.com)
All rights reserved.

Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Thierry Schellenbach. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Thierry Schellenbach.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Description: ######################################################################
        Django Facebook by Thierry Schellenbach (`mellowmorning.com <http://www.mellowmorning.com/>`_)
        ######################################################################
        
        First
        -----
        
        Django Facebook assumes you want users to register through Facebook.
        After registration it gives you access to the graph, allowing for such applications as:
        
        * Inviting friends
        * Finding friends
        * Posting to a users profile
        * Open graph beta functionality
        
        For a demo of the signup flow have a look at Fashiolista's landing page (`fashiolista.com <http://www.fashiolista.com/intro_wide_minimal/>`_)
        
        
        Contributions are welcome!!
        Contact me here or `@tschellenbach <http://www.twitter.com/tschellenbach>`_
        Updates and tutorials can be found on my blog `mellowmorning <http://www.mellowmorning.com/>`_
        
        
        
        About Django Facebook
        ---------------------
        
        **Features**
        
        * Access the Facebook API, from:
           * Your website (Using javascript OAuth)
           * Facebook canvas pages (For building facebook applications)
           * Mobile (Or any other flow giving you a valid access token)
        * Django User Registration (Convert Facebook user data into a user model)
        * Use Facebook data to register a user with your Django app. Facebook connect using the open graph API.
        * Facebook FQL access
        * OAuth 2.0 compliant
        * Includes Open Facebook (stable and tested python client to the graph API)
        
        
        Requirements
        ------------------------------
        * Django registration or Django Userena (contact me if you use something else for registration.) 
        
        
        Installation
        ------------
        
        Download the source code or use ``pip install django_facebook``.
        
        
        **Create a Facebook App**
        
        In case you don't yet have a facebook app. You need an app to use the open graph api and make the login process work.
        You can create a facebook app at this url: http://www.facebook.com/developers/createapp.php
        
        **Settings**
        
        Define the following settings in your settings.py file:
        
        ::
        
            FACEBOOK_APP_ID
            FACEBOOK_APP_SECRET
        
        **Url config, context processor, auth backend**
        
        add django facebook to your installed apps::
        
            'django_facebook',
        
        add this line to your context processors (``TEMPLATE_CONTEXT_PROCESSORS``
        setting)::
        
            'django_facebook.context_processors.facebook',
        
        add this to your ``AUTHENTICATION_BACKENDS`` setting::
        
            'django_facebook.auth_backends.FacebookBackend',
            
        add this line to your url config::
        
            (r'^facebook/', include('django_facebook.urls')),
        
        **Update your models**
        
        An abstract model is specified here django_facebook/models.py
        Add these fields to your profile model or subclass the abstract class.
        See the django docs for settings up a Profile model or understanding abstract classes.
        
        **Check the example**
        
        Right now you should have a working registration/connect/login in flow available at /facebook/connect/
        Test if everything is working and ensure you didn't miss a step somewhere.
        If you encounter any difficulties please open an issue.
        
        **Django Userena**
        
        A few settings changes are needed to play nicely with Django Userena.
        In your settings point Django Facebook to the right registration form and template:
        
        ::
        
            FACEBOOK_REGISTRATION_FORM = 'userena.forms.SignupForm'
            FACEBOOK_REGISTRATION_TEMPLATE = 'userena/signup_form.html'
        
        Supporting any other registration system is quite easy.
        Adjust the above settings to point to your own code.
        Note that the form's save method needs to return the new user object.
        
        
        **Common bugs**
        
        Django Facebook expects that you are using static files in order to load the required javascript.
        If you are not using staticfiles you should load facebook.js provided in the static directory manually.
        
        Another common issue are the url matching settings from Facebook. Facebook requires you to fill in a domain for your application.
        In order for things to work with local development you need to use the same domain. So if you production site is www.mellowmorning.com you
        should run your development server on something like local.mellowmorning.com in order for facebook to allow authentication.
        
        If you encounter any difficulties please open an issue.
        
        **Customize and integrate into your site**
        
        Not it's time to customize things a little.
        For an example you can look at connect.html in the templates directory.
        
        First load the css:
        
        ::
        
            <link href="{{ STATIC_URL }}css/facebook.css" type="text/css" rel="stylesheet" media="all" />
        
        Secondly load the javascript:
        
        ::
        
            {% include 'django_facebook/_facebook_js.html' %}
            
        If you encounter issues here you probably don't have django static files setup correctly. 
        Alternatively you might be missing the context processor.
        
        
        Subsequently implement a form which calls Facebook via javascript.
        Note that you can control which page to go to after connect using the next input field.
        
        ::
        
        <form action="{% url facebook_connect %}?facebook_login=1" method="post">
        <a href="javascript:void(0);" style="font-size: 20px;" onclick="F.connect(this.parentNode);">Register, login or connect with facebook</a>
        <input type="hidden" value="{{ request.path }}" name="next" />
        </form>
        
        
        
        Signals
        -------
        
        Django-facebook ships with a few signals that you can use to easily accommodate Facebook related activities with your project.
        
        ``facebook_user_registered`` signal is sent whenever a new user is registered by Django-facebook, for example:
        
        ::
        
            from django.contrib.auth.models import User
            from django_facebook import signals
        
            def fb_user_registered_handler(sender, user, facebook_data, \*\*kwargs):
                # Do something involving user here
        
            signals.facebook_user_registered.connect(user_registered, sender=User)
        
        
        ``facebook_pre_update`` signal is sent just before Django-facebook updates the profile model with Facebook data. If you want to manipulate Facebook or profile information before it gets saved, this is where you should do it. For example:
        
        ::
            
            from django_facebook import signals
            from django_facebook.utils import get_profile_class
        
            def pre_facebook_update(sender, profile, facebook_data, \*\*kwargs):
                profile.facebook_information_updated = datetime.datetime.now()
                # Manipulate facebook_data here
            
            profile_class = get_profile_class()
            signals.facebook_pre_update.connect(pre_facebook_update, sender=profile_class)
        
        
        ``facebook_post_update`` signal is sent after Django-facebook finishes updating the profile model with Facebook data. You can perform other Facebook connect or registration related processing here. 
        
        ::
            
            from django_facebook import signals
            from django_facebook.utils import get_profile_class
        
            def post_facebook_update(sender, profile, facebook_data, \*\*kwargs):
                # Do other stuff
            
            profile_class = get_profile_class()
            signals.facebook_post_update.connect(post_facebook_update, sender=profile_class)
        
        ``facebook_post_store_friends`` signal is sent after Django-facebook finishes storing the user's friends.   
        
        ::
            
            from django_facebook import signals
            from django_facebook.utils import get_profile_class
        
            def post_facebook_update(sender, user, friends, current_friends, inserted_friends, \*\*kwargs):
                # Do other stuff
            
            profile_class = get_profile_class()
            facebook_post_store_friends.connect(post_facebook_update, sender=profile_class)
        
        ``facebook_post_store_likes`` signal is sent after Django-facebook finishes storing the user's likes. This is usefull if you want to customize what topics etc to follow.   
        
        ::
            
            from django_facebook import signals
            from django_facebook.utils import get_profile_class
        
            def post_facebook_update(sender, user, likes, current_likes, inserted_likes, \*\*kwargs):
                # Do other stuff
            
            profile_class = get_profile_class()
            facebook_post_store_likes.connect(post_facebook_update, sender=profile_class)
        
        
        
        
        
        Contributing and Running tests
        ------------------------------
        Tests are run from within the example project. You
        can run them yourself as follows:
        
        install from git
        
        facebook_example/manage.py test django_facebook
        
        Todo:
        
        * Canvas utility functions (abstracting javascript redirects) (in progress)
        * Token expiration detection (check out https://github.com/aidaeology/Django-facebook/commit/8585ce223e18cf19f410b4e6aa56b1478913162e for an older version of this concept)
        * Improve testing
        
        
        Django Jobs
        -----------
        Do you also see the beauty in clean code? Are you experienced with high scalability web apps?
        Currently we're looking for additional talent over at our Amsterdam office.
        Feel free to drop me a line at my personal email for more information: thierryschellenbach[at]gmail.com
        
        
        
        
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License (GPL)
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: Django
