Skip to main content

Django helper for Lona

Project description

This package contains Lona helper to integrate with Django.

Installation

$ pip install lona-django

Django Auth

Django authentication, authorization and sessions are implemented in a Lona middleware.

# settings.py

MIDDLEWARES = [
    'lona_django.middlewares.DjangoSessionMiddleware',
]

To configure authorization use the view flags listed below. The flags are all optional and can be mixed.

The Django user associated with the given request is available in request.user.

# views.py

from lona import LonaView

class DjangoView(LonaView):
    DJANGO_AUTH_LOGIN_REQUIRED = False
    DJANGO_AUTH_STAFF_REQUIRED = False
    DJANGO_AUTH_STAFF_PERMISSION_OVERRIDE = True
    DJANGO_AUTH_PERMISSIONS_REQUIRED = []
    DJANGO_AUTH_GROUPS_REQUIRED = []

    def handle_request(self, request):
        user = request.user

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

lona-django-0.1.1.tar.gz (4.3 kB view hashes)

Uploaded Source

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