Reusable, generic mixins for Django
BSD-3-CLAUSE License
Bot releases are visible (Hide)
Published by kennethlove almost 5 years ago
Published by kennethlove over 8 years ago
six
to remove an external dependency.MultipleGroupRequiredMixin
and GroupRequiredMixin
.OrderableListView
.SuccessURLRedirectListMixin
.PermissionsRequiredMixin
and MultiplePermissionsRequiredMixin
.user_passes_test
decorator.SSLRequiredMixin
. Redirect http -> https.RecentLoginRequiredMixin
to require user sessions to have a given freshness.resolve_url
to handle LOGIN_REDIRECT_URL
s in settings.py
that are just URL names.JSONResponseMixin
to allow setting a custom JSON encoder class.LoginRequiredMixin
so it's possible to redirect unauthenticated users whileAccessMixin
-derived mixins instead of throwing an exception.Published by chrisjones-brack3t over 10 years ago
views.py
out into multiple files since it was approaching 1000 LoC.SetHeadlineMixin
now accepts headline
with ugettext_lazy()
-wrapped strings.JSONResponseMixin
would override the content_type
of Django's TemplateView
in Django 1.6.PermissionRequiredMixin
where if PermissionRequiredMixin.no_permissions_fail
returned a false-y value, the user lacking the permission would pass instead of being denied access.MessageMixin
to allow easier access to Django's contrib.messages
messages. FormValidMessageMixin
and FormInvalidMessageMixin
were updated to use it.CanonicalSlugDetailMixin
to allow it to use custom URL kwargs.GroupRequiredMixin
where superusers were blocked by lack of group memberships.GroupRequiredMixin
which now correctly checks for group membership against a list.StaticContextMixin
mixin which lets you pass in static_context
as a property of the view.AnonymousRequiredMixin
which redirects authenticated users to another view.AllVerbsMixin
which allows a single method to response to all HTTP verbs.JSONRequestResponseMixin
as a mirror of JsonRequestResponseMixin
because we're not PHP.FormValidMessageMixin
, FormInvalidMessageMixin
, and FormMessagesMixin
all allow ugettext_lazy
-wrapped strings.PermissionRequiredMixin
and MultiplePermissionsRequiredMixin
to accept django-guardian-style custom/object permissions.Published by kennethlove almost 11 years ago
Published by kennethlove almost 11 years ago
CreateAndRedirectToEditView
mixin. It was marked for deprecation and removal since 1.0.JsonRequestAndResponseMixin
mixin which attempts to parse requests as JSON.CanonicalSlugDetailMixin
mixin which allows for the specification of a canonical slug on a DetailView
to help with SEO by redirecting on non-canonical requests.UserPassesTestMixin
mixin to replicate the behavior of Django's @user_passes_test
decorator.CanonicalSlugDetailMixin
.AccessMixin
now has a runtime-overridable login_url
attribute.GroupRequiredMixin
that made it not actually work.Published by kennethlove about 11 years ago
six.string_types
instead of explicitly relying on str
and unicode
types.Published by kennethlove about 11 years ago
reverse_lazy
to work for all AccessMixin
-derived mixins.Published by kennethlove about 11 years ago
FormValidMessageMixin
which provides a messages
message when the processed form is valid.FormInvalidMessageMixin
which provides a messages
message when the processed form is invalid.FormMessagesMixin
which provides the functionality of both of the above mixins.GroupRequiredMixin
which is a new access-level mixin which requires that a user be part of a specified group to access a view.Published by kennethlove over 11 years ago
JSONResponseMixin.render_json_response
method updated to accept a status code.JSONResponseMixin
added json_dumps_kwargs
attribute & get method to pass args to the json encoder.OrderableListMixin
allows ordering of list views by GET params.