I overrided django admin login page and would like to pass some variables to the login page. How can I do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: let me make it clear that I personally think you should write your own login view if you want to influence the context, namely because it’s so simple (you can copy and paste the ~20 lines to your own view).
Since what I like to do on stackoverflow is find a way around anyways, here’s a hacky alternative:
If you want to use the built in admin page the only method I see is to attach properties to
AuthenticationForm.Here’s
django.contrib.auth.views.login:The only place we can ‘hitch a ride’ into the login template while positively not affecting anything else is through
AuthenticationForm.Another alternative is to use a context processor, which injects variables into every view that uses
RequestContext. Use this if your variable has some use in other templates as well.