Django Braces compatibility

The django-vanilla-views package is almost completely compatible with the mixin classes provided by the popular django-braces package.

The full set of mixins is listed below. If you believe any of these entries to be incorrect, or if new mixins are added that are not listed here, then please open an issue on GitHub so we can keep the information up to date.

Access Mixins

Mixin classAPI compatible
LoginRequiredMixinYes
PermissionRequiredMixinYes
MultiplePermissionsRequiredMixinYes
GroupRequiredMixinYes
SuperuserRequiredMixinYes
StaffuserRequiredMixinYes

Form Mixins

Mixin classAPI compatible
CsrfExemptMixinYes
UserFormKwargsMixinNo (*)
UserKwargModelFormMixinYes
SuccessURLRedirectListMixinYes
FormValidMessageMixinYes
FormInvalidMessageMixinYes
FormMessagesMixinYes

(*) The UserFormKwargsMixin class is not compatible because it overrides the get_form_kwargs() method, which does not exist in django-vanilla-views.

You can instead write a django-vanilla-views compatible mixin, like this:

class UserFormKwargsMixin(object):
    def get_form(self, data=None, files=None, **kwargs):
        kwargs['user'] = self.request.user
        return super(UserFormKwargsMixin, self).get_form(data=data, files=files, **kwargs)

Other Mixins

Mixin classAPI compatible
SetHeadlineMixinYes
SelectRelatedMixinYes
PrefetchRelatedMixinYes
JSONResponseMixinYes
JsonRequestResponseMixinYes
AjaxResponseMixinYes
OrderableListMixinYes
CanonicalSlugDetailMixinYes (*)

(*) The CanonicalSlugDetailMixin is not compatible in the current 1.2.2 PyPI release, but is compatible in the current master branch, and should be compatible in the next upcoming PyPI release.

Note that if using CanonicalSlugDetailMixin you must also set a slug_url_kwarg on the view.