Metadata-Version: 1.1
Name: django-profiletools
Version: 0.1.2
Summary: Tools for Profile models in Django.
Home-page: http://github.com/pydanny/django-profiletools
Author: Daniel Greenfeld
Author-email: pydanny@gmail.com
License: MIT
Description: ===================
        django-profiletools
        ===================
        
        Features
        ========
        
        * Lazy loading of your authenticated `profile` record across the `request` object lifetime. That means in the Python code and the templates.
        * Name your profile model anything you want in `settings.AUTH_PROFILE_MODULE`.
        
        Installation
        ============
        
        Get the code::
        
        	pip install django-profiletools
        
        Install the middleware and context_processor in your settings.py::
        
        	TEMPLATE_CONTEXT_PROCESSORS = (
        		...
        	    'profiletools.context_processors.fetch_profile',
        	)
        
        	MIDDLEWARE_CLASSES = (
        	...
        	'profiletools.middleware.LazyProfileMiddleware',
        	)
        
        Also in settings.py, set the AUTH_PROFILE_MODULE to your profile model::
        
        	AUTH_PROFILE_MODULE = "profiles.Profile"
        
        Based on that, your profile model should resemble something like::
        
        	# profiles.models.Profile.py
        	from django.contrib.auth.models import User
        	from django.db import models
        
        	class Profile(models.Model):
        
        	    user = models.OneToOneField(User)
        	    
        	    def __unicode__(self):
        	        return self.user.username
        
        **note:** If you don't use ``profiles.models.Profile``, say ``members.models.UserProfile`` go ahead and change the ``AUTH_PROFILE_MODULE`` to "members.UserProfile".
        
        Usage
        ------
        
        In your templates::
        
        	{{ request.my_profile }}
        
        In your functional views::
        
        	profile = request.my_profile
        
        In your class-based views::
        
        	profile = self.request.my_profile	
        
        Call my_profile as many times as you want, it only loads once. So if you call it 100 times in a view, the ``SQL SELECT`` is only done the first time.  If no user is found then the my_profile call result is ``None``, which makes it easier to handle templates which need to be able to handle unauthenticated users (like the `about` page).
        
        
        **note:** If you are using the ``members.UserProfile`` example, you'll need to call that by using ``request.my_userprofile``.
        
        Inspiration
        ===========
        
        The lazy loading of profiles was inspired by the rather incredible Noah Kantrowitz.
        
Keywords: django,profiles
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
