Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brack3t/django-brackets
Small mixins for Django's generic class-based views.
https://github.com/brack3t/django-brackets
cbv cbvs django django-braces python view
Last synced: 20 days ago
JSON representation
Small mixins for Django's generic class-based views.
- Host: GitHub
- URL: https://github.com/brack3t/django-brackets
- Owner: brack3t
- License: apache-2.0
- Created: 2023-06-03T06:06:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-04-17T21:32:41.000Z (9 months ago)
- Last Synced: 2024-12-16T19:52:17.800Z (27 days ago)
- Topics: cbv, cbvs, django, django-braces, python, view
- Language: Python
- Homepage:
- Size: 798 KB
- Stars: 16
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# django-brackets
[Official Documentation](https://django-brackets.readthedocs.io)
`django-brackets` is a small collection of mixins for your class-based
views' needs. Heavily based on [`django-braces`], `brackets` aims to be
a simpler API and lighter tool set than `braces` was.`django-brackets` is developed against and for still-supported versions
of Django and the latest (or near enough) version of Python. It also
offers mixins for `django-rest-framework` which should work with the
latest release of that package.As always, [contributions](docs/contributors.md) are welcome.
## Available mixins
(in alphabetical order)### Django class-based views
* `AllVerbsMixin` - View answers any HTTP verb with a single method.
* `AnonymousRequiredMixin` - Authenticated users are rejected.
* `CacheControlMixin` - Control how the view is cached
* `CSRFExemptMixin` - View does not require CSRF tokens.
* `FormWithUserMixin` - Automatically provides the requesting user to the form.
* `GroupRequiredMixin` - Requesting user must be part of a group.
* `HeaderMixin` - Statically set headers for a view.
* `LoginRequiredMixin` - Non-authenticated users are rejected.
* `MultipleFormsMixin` - View handles multiple forms at once. Taken from [`django-shapeshifter`]
* `NeverCacheMixin` - Mark a view as being uncached.
* `OrderableListMixin` - Allow queryset ordering via query string arguments.
* `PassesTestMixin` - Requests must pass a test before they are dispatched.
* `PassOrRedirectMixin` - Failing requests are redirected to another view.
* `PermissionRequiredMixin` - Requesting user must have specific permissions.
* `PrefetchRelatedMixin` - Add `prefetch_related` clauses into the view's queryset.
* `RecentLoginRequiredMixin` - Users must have logged in recently.
* `RedirectMixin` - Easily redirect requests.
* `RedirectToLoginMixin` - Redirect requests to a login page.
* `SelectRelatedMixin` - Add `select_related` clauses into the view's queryset.
* `SSLRequiredMixin` - Requests must be secure or redirected.
* `StaffUserRequiredMixin` - Requesting user must be a staff member.
* `StaticContextMixin` - Provide a static context to a view.
* `SuperuserRequiredMixin` - Requesting user must be a superuser.### Django REST Framework
* `MultipleSerializersMixin` - View/Viewset can have multiple serializers.
### Django forms
* `UserFormMixin` - Expects a `"user"` keyword argument, which will become `self.user`.
[`django-braces`]: https://github.com/brack3t/django-braces
[`django-shapeshifter`]: https://github.com/kennethlove/django-shapeshifter