Django-common consists of the following things:
- A middleware that makes sure your web-app runs either on or without 'www' in the domain.
SessionManagerBasebase class, that helps in keeping your session related code object-oriented and clean! See session.py for usage details.
EmailBackendfor authenticating users based on their email, apart from username.
- Some custom db fields that you can use in your models including a
- Bunch of helpful functions in helper.py
render_form_fieldtemplate tag that makes rendering form fields easy and DRY.
- A couple of dry response classes:
XMLResponsein the django_common.http that can be used in views that give json/xml responses.
Install django_common (ideally in your virtualenv!) using pip or simply getting a copy of the code and putting it in a directory in your codebase.
django_commonto your Django settings
INSTALLED_APPS = [ # ... "django_common", ]
Add the following to your settings.py with appropriate values:
common_settingsto your Django settings
TEMPLATE_CONTEXT_PROCESSORS = [ # ... "common_settings", ]
EmailBackendto the Django settings
AUTHENTICATION_BACKENDS = ( 'django_common.auth_backends.EmailBackend', 'django.contrib.auth.backends.ModelBackend' )
WWWRedirectMiddlewareif required to the list of middlewares:
MIDDLEWARE_CLASSES = [ # ... "WWWRedirectMiddleware", ]
This open-source app is brought to you by Tivix, Inc. ( http://tivix.com/ )