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

  • SEARCH
  • Home
  • 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 6931357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:33:59+00:00 2026-05-27T11:33:59+00:00

Possible Duplicate: Putting a django login form on every page how can I add

  • 0

Possible Duplicate:
Putting a django login form on every page

how can I add a log-in in my main_page in django? let us say that in my main_page i just want to have a log-in. for example, in my http://www.example.com, i have a log-in division for any user who visit the site.

here is my urls.py

urlpatterns = patterns('',
    (r'^$', main_page),
    (r'^product/$', product_save),
    (r'^reserve/$', reserve_page),
    (r'^product/select/$', product_select),
    (r'^book/$', book_save),
    (r'^api/', include('bookproj.api.urls')),
    (r'^media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': os.path.join(settings.BASE_DIR, 'media'),
         'show_indexes': True}),
    (r'^login/$', 'django.contrib.auth.views.login'),)

my views.py :

def main_page(request):
    product = Product.objects.all()

    template = get_template('main_page.html')
    variables = RequestContext(request, { 'product': product})
    return render_to_response(
        'main_page.html', variables
    )

in logging-in i just type to www.example.com/login , this line direct us to log-in method :

(r'^login/$', 'django.contrib.auth.views.login')

but its direct us to another page to call the login.html. how can i do it that in main_page.html have already a log-in and I cannot go anymore to www.example.com/login to log-in?

does anyone have an idea about my question? can i add another views or modify my main_page view?

thanks…

  • 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-27T11:34:00+00:00Added an answer on May 27, 2026 at 11:34 am

    had this issue before , i think code here does exactly what you need
    http://www.nerdydork.com/django-login-form-on-every-page.html

    that explains how to put login on every page( by passing it to the base template )
    if you want it only in the main page .. pass it to the main page instead of the base template
    it’s a tutorial that explain how to build such a tasks . hope it helps

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

Sidebar

Related Questions

Possible Duplicate: Automatic exit from bash shell script on error How can I have
Possible Duplicate: Parsing text in C Say I have written to a text file
Possible Duplicate: Can you write object oriented code in C? Hi, can someone point
Possible Duplicate: Can you call Directory.GetFiles() with multiple filters? Does it possible to get
Possible Duplicate: Evaluate C# string with math operators So lets say I have a
Possible Duplicate: file_put_contents permission denied I have recently transferred server, and it seems that
Possible Duplicate: In vim is there a way to delete without putting text in
Possible Duplicate: jquery - Is $(document).ready necessary? Putting the JS just above the </body>
Possible Duplicate: Write a recursive function that reverses the input Recently, I've been reading
Possible Duplicate: Operator overloading Hi guys can some one please suggest a good tutorial

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.