Helpful mixins for Django View classes.
Project description
Provides some common mixin patterns for Django’s View classes.
Installation
Run pip install django-viewclass-mixins
View Mixins
###LoginMixin Ensures the view is being requested by an authenticated user or redirects to the login page. It behaves the same as the function decorator login_required.
###StaffRequiredMixin Ensures the view is being request by an authenticated user that is marked as staff.
###SuperuserRequiredMixin Ensures the view is being request by an authenticated user that is marked as a superuser.
###OwnershipMixin A mixin to single-object views. Ensures the view is by requested by the owner of the requested object.
###DeactivateMixin A mixin to the DeleteView. Instead of deleting an object it will mark it as inactive instead.
###FilterListMixin A mixin to the ListView. It will apply filters from the URL querystring to the underlying QuerySet before the list is returned.
###ModelFormSetMixin A mixin to the CreateView and UpdateView. It take a list of FormSets and validates and saves them along with the main model.
###HttpCacheMixin A mixin to any View. It has methods for setting HTTP cache headers like Cache-Control, Vary, ETag, and Last-Modified.
###CorsMixin A mixin to a Django Rest Framework View. It sets permissive CORS headers and handles the OPTIONS response.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-viewclass-mixins-1.1.1.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fd982606b1f110e55d53d9f5423114ad903656b221e53617cfded7b64cca237 |
|
MD5 | 9ed2b85173b24f710e5e569b7736708a |
|
BLAKE2b-256 | 2882daadfb5bee61a9d7f776d0d6f2e1774e57982de305aef8db940d8a3dabe6 |