Skip to main content

No project description provided

Project description

mixins

Custom Django mixins for class based views

Getting started

Install mixins:

pip install dj-mixins

Now you can start using the mixins.

Usage

Let's say that we want to implement a view that accepts requests from superusers only. To achieve this we can use SuperUserMixin:

""" Views.py """


from django.views.generic import TemplateView
from mixins.mixins import SuperUserMixin


# Create your views here.
class SuperUserView(SuperUserMixin, TemplateView):
    """ A view that accepts request from superusers only """

    template_name = 'myapp/index.html'

I hope that you find this useful.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

dj_mixins-0.1.1-py3-none-any.whl (35.3 kB view hashes)

Uploaded Python 3

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