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 class | API compatible |
|---|---|
| LoginRequiredMixin | Yes |
| PermissionRequiredMixin | Yes |
| MultiplePermissionsRequiredMixin | Yes |
| GroupRequiredMixin | Yes |
| SuperuserRequiredMixin | Yes |
| StaffuserRequiredMixin | Yes |
Form Mixins
| Mixin class | API compatible |
|---|---|
| CsrfExemptMixin | Yes |
| UserFormKwargsMixin | No (*) |
| UserKwargModelFormMixin | Yes |
| SuccessURLRedirectListMixin | Yes |
| FormValidMessageMixin | Yes |
| FormInvalidMessageMixin | Yes |
| FormMessagesMixin | Yes |
(*) 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 class | API compatible |
|---|---|
| SetHeadlineMixin | Yes |
| SelectRelatedMixin | Yes |
| PrefetchRelatedMixin | Yes |
| JSONResponseMixin | Yes |
| JsonRequestResponseMixin | Yes |
| AjaxResponseMixin | Yes |
| OrderableListMixin | Yes |
| CanonicalSlugDetailMixin | Yes (*) |
(*) 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.