class AccessMixin
-
login_url
-
Default return value for
get_login_url()
. Defaults toNone
in which caseget_login_url()
falls back tosettings.LOGIN_URL
.
-
permission_denied_message
-
Default return value for
get_permission_denied_message()
. Defaults to an empty string.
-
redirect_field_name
-
Default return value for
get_redirect_field_name()
. Defaults to"next"
.
-
raise_exception
-
If this attribute is set to
True
, aPermissionDenied
exception will be raised instead of the redirect. Defaults toFalse
.
-
get_login_url()
-
Returns the URL that users who don’t pass the test will be redirected to. Returns
login_url
if set, orsettings.LOGIN_URL
otherwise.
-
get_permission_denied_message()
-
When
raise_exception
isTrue
, this method can be used to control the error message passed to the error handler for display to the user. Returns thepermission_denied_message
attribute by default.
-
get_redirect_field_name()
-
Returns the name of the query parameter that will contain the URL the user should be redirected to after a successful login. If you set this to
None
, a query parameter won’t be added. Returns theredirect_field_name
attribute by default.
-
handle_no_permission()
-
Depending on the value of
raise_exception
, the method either raises aPermissionDenied
exception or redirects the user to thelogin_url
, optionally including theredirect_field_name
if it is set.
Please login to continue.