Make AccessMixin.login_url changeable at runtime #92

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@jnns
Contributor
jnns commented Nov 20, 2013

AccessMixin.login_url is defined at import time according to settings.LOGIN_URL and this applies for all request. There's no way to change it.

Sometimes it's neccessary to be able to change settings on the fly; for example during testing. Django offers a way to override settings via django.test.utils.override_settings but changing settings.LOGIN_URL won't affect views that inherit from AccessMixin because their login_url was set at import time.

This fixes #91.

@jnns jnns Don't set AccessMixin.login_url at import time.
AccessMixin.login_url is defined once and for all requests at import time which
renders dynamic altering of settings.LOGIN_URL useless.
This fixes #91.
9df2b6b
@kennethlove kennethlove closed this Jan 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment