Opened 4 years ago

Closed 4 years ago

#32086 closed Cleanup/optimization (wontfix)

Misleading documentation on AccessMixin

Reported by: Remy Owned by: nobody
Component: Documentation Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In this section of the documentation: https://docs.djangoproject.com/en/3.1/topics/auth/default/#redirecting-unauthorized-requests-in-class-based-views

We can read:

To ease the handling of access restrictions in class-based views, the AccessMixin can be used to configure the behavior of a view when access is denied. Authenticated users are denied access with an HTTP 403 Forbidden response. Anonymous users are redirected to the login page or shown an HTTP 403 Forbidden response, depending on the raise_exception attribute.

Which leads the reader to think that AccessMixin actually does something, e.g redirect anonymous users to the login page etc, when actually no, AccessMixin won't do any of that. It's just an abstract class that is overloaded by other mixins in order to achieve such behaviors.

I suggest we should clarify that. Maybe rewrite so that those are shown as example use cases, achievable after implementing some of the django mixins that subclass AccessMixin (e.g LoginRequiredMixin).

Change History (1)

comment:1 by Carlton Gibson, 4 years ago

Resolution: wontfix
Status: newclosed

Hi Remy. I'm going to say wontfix here.

The combination of Mixin and view here seems clear enough already to me:

...the AccessMixin can be used to configure the behavior of a view when access is denied...

Nonetheless, you're welcome to submit a PR with a proposed adjustment. If that looks clearer on review we can always reopen and Accept.
I hope that seems fair.
Thanks.

Note: See TracTickets for help on using tickets.
Back to Top