Skip to main content

A simple Django app to switch between users without authentication.

Project description

Django Easy Login is a Django app that allows end-users to login with already created users at the system without authentication.

Quick start

  1. Add ‘easy_login’ to your INSTALLED_APPS settings:

INSTALLED_APPS = [
...
'easy_login',
...
]
  1. Now edit the example/urls.py module in your project:

urlpatterns = [
...
url(r'^easy_login/', include('easy_login.urls', namespace='easy-login')),
...
]
  1. Set middleware class:

TEMPLATES = [
    ...
    'context_processors': [
        'easy_login.context_processors.easy_login',
    ...
    ],
]
  1. Define default url redirect:

EASY_URL_REDIRECT = 'test-app:index'
  1. In template define easy_login variable:

{{ easy_login }}

Customization

You can change the view settings up to your wishes. For customizing view settings please put this to the settings:

EASY_LOGIN_SETTINGS = {
'FILTER': {},           # --> dict;
'LIMIT': None,          # --> int;
'LABELS': [],           # --> list, lambda;
'LOGIN_BY': '',         # --> str;
'GET_BY': '',           # --> str;
'LOGIN_BUTTON': ''      # --> str;
}

Options:

  • FILTER - possible type - dict; Using this option you can by the attributes filter objects which are shown in the select bar. For example 'FILTER': {'username': 'admin'}. By default - None.

  • LIMIT - possible type - int; Limit number of records in dropdown. You can put None if you don’t want to limit the number of users for select. By default - 10.

  • LABELS - possible type - list, lambda; You can change the label of users displayed in dropdown. For example you can add roles, permissions and any other important information. Also, you can use lambda expression here, for ex. 'LABELS': lambda x: x.username + ' - ' + str(x.id). By default - __str__ method of your object.

  • LOGIN_BY - possible type - str, values: ‘select’, ‘id’, ‘both’; You can enable login with select field, ID input or both. By default - ‘both’.

  • GET_BY - possible type - str; You can change attribute by which you will authorize. By default - ‘id’.

  • LOGIN_BUTTON - possible type - str; You can change login button label. By default - ‘Login’.

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

django-easy-login-0.1.1.tar.gz (12.3 kB view details)

Uploaded Source

File details

Details for the file django-easy-login-0.1.1.tar.gz.

File metadata

  • Download URL: django-easy-login-0.1.1.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.6.4

File hashes

Hashes for django-easy-login-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bb806821b9b1121b5e2bec9566d018757b26563bf2ee435ae49464a3f185e403
MD5 117de30a37efd8c4fac6d45607a6cf6d
BLAKE2b-256 b7256b6cf22d9a5079a4a60a1da148a92b68cf9ef8d34152699b8289ee5a3e05

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