Skip to main content

A series of class based view mixins.

Project description

Series of Class based mixins. Requires Django 1.4s use of PermissionDenied exception.

Installation

pip install django-infuse

Currently Supported Mixins

  • Permission Required

  • Staff Required

  • Super User required

  • Login Required

  • Group Required

Usage

### Login Required Mixin

Inherit the mixin you want to use and add any additional (optional) params.

from infuse.auth.permissions import LoginRequiredMixin

class MyLoginProtectedView(LoginRequiredMixin, ListView):

# If login_url is not the url you want to redirect # users to, set one here.

login_url = “/my/new/url/”

# Do the rest of your stuff…..

### Group Required Mixin

The only other different one is GroupRequiredMixin

from infuse.auth.permissions import GroupRequiredMixin

class MyGroupRequiredView(GroupRequiredMixin, ListView):

# Uses login_required, so you can optionally pass in # a url just like LoginRequired.

# You MUST set a group, Infuse will throw an exception # if you do not.

group = “My Awesome Group”

### Permission Required Mixin

Original work by Kenneth Love and Chris Jones. Modified to always raise PermissionDenied

from infuse.auth.permissions import PermissionRequiredMixin

class PermissionRequiredView(PermissionRequiredMixin, ListView):

# Permission to require permssion_required = ‘model.can_do_something’

### What is Next?

  • Wizard Mixin Helpers

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-infuse-0.2.1.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file django-infuse-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-infuse-0.2.1.tar.gz
Algorithm Hash digest
SHA256 db2d0def1d40ff34ceb37bf0818973aa877913b94bc44ad4be82b8f82d1c10cc
MD5 4cfaa24f026c63fe4f05b72b54006825
BLAKE2b-256 bc4781f3a852ff485308a903db202c7d81407a879c60e65430922bd54a5561b2

See more details on using hashes here.

Provenance

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