Skip to main content

Generic utilities for django

Project description

Installation

  1. Install with pip install djgeneric" or add "djgeneric" directory to your Python path.

  2. Add "djgeneric" to the INSTALLED_APPS tuple found in your settings file.

  3. Run manage.py syncdb to create the new tables

Username and email login

To allow login with username or email, add to settings:

AUTHENTICATION_BACKENDS += ('djgeneric.auth.EmailAuthBackend',)

Optionally you can use the form in djgeneric.auth.CustomAuthenticationForm.

Google Analitics

To use the google analitics code, add to settings:

GOOGLE_ANALYTICS_PROPERTY_ID = 'UA-14845987-3'
GOOGLE_ANALYTICS_DOMAIN = 'mydomain.com'

TEMPLATE_CONTEXT_PROCESSORS += ('djgeneric.contect_processors.google_analitics',)

And then in your base template add:

{% include 'djgeneric/ga.html' %}

Login required middleware

To use the login required middleware, add to settings:

LOGIN_REQUIRED_URLS = (
    r'/topsecret/(.*)$',
)
LOGIN_REQUIRED_URLS_EXCEPTIONS = (
    r'/topsecret/login(.*)$',
    r'/topsecret/logout(.*)$',
)

MIDDLEWARE_CLASSES += ('djgeneric.middleware.RequireLoginMiddleware',)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djgeneric-0.1.2.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file djgeneric-0.1.2.tar.gz.

File metadata

  • Download URL: djgeneric-0.1.2.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djgeneric-0.1.2.tar.gz
Algorithm Hash digest
SHA256 233d0049cb5ae6600187915205711c1b65bf431bbaf32077bc12e34cdd7aae37
MD5 71eb2b513b7c9a43b33b60f6f3efc57e
BLAKE2b-256 e7006d70abfa7d651941b3edd6033de3dad0e4c436b405f8b8b9bbb9421ed7a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page