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.17.tar.gz (5.6 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: djgeneric-0.1.17.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

File hashes

Hashes for djgeneric-0.1.17.tar.gz
Algorithm Hash digest
SHA256 bc76889149aea9a799b7030f52ba72c0cd57800b1954e0a1043cb44e399f1fab
MD5 cb5654a87a3fe3a9d9f60e3e365bcd5b
BLAKE2b-256 ae560edfcd6ef5e1801929c8d6ec91399d007b434de5524af6b851c2721153ae

See more details on using hashes here.

Supported by

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