Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4026228
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:56:39+00:00 2026-05-20T10:56:39+00:00

I overrided django admin login page and would like to pass some variables to

  • 0

I overrided django admin login page and would like to pass some variables to the login page. How can I do that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:56:39+00:00Added an answer on May 20, 2026 at 10:56 am

    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:

    def login(request, template_name='registration/login.html',
              redirect_field_name=REDIRECT_FIELD_NAME,
              authentication_form=AuthenticationForm):
        ....
        return render_to_response(template_name, {
            'form': form,
            redirect_field_name: redirect_to,
            'site': current_site,
            'site_name': current_site.name,
        }, context_instance=RequestContext(request))
    

    The only place we can ‘hitch a ride’ into the login template while positively not affecting anything else is through AuthenticationForm.

    from django.contrib.auth.forms import AuthenticationForm
    
    AuthenticationForm.foobar = 'Hello'
    ...
    (r'^accounts/login/$', 'django.contrib.auth.views.login', \
          {'authentication_form':AuthenticationForm),
    
    # template
    {{ form.foobar }}
    

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom django admin page, and I would like to make the
I would like to figure out where everything is in django admin. Since i
I was looking at some Django examples and I've noticed that you can call
I'm creating some custom views for the Django admin interface that use the standard
I've got a Django-based site that allows users to register (but requires an admin
I'm working on a Django project, and I've created some custom admin views using
I have values in a database that are encrypted, how can I override django's
I want to make a very small change to the Django admin logout page.
I'm using a soft delete in my django admin, done like this . The
On Django's admin pages, I'd like to perform an action when the administrator clicks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.