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 9206373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:09:42+00:00 2026-06-18T00:09:42+00:00

I have a requirement to display a particular page in a website that is

  • 0

I have a requirement to display a particular page in a website that is developed in Python/Django from another website.
If the user is logged into the python/Django site then display the requested page. Currently i’m using the ‘request.user.is_authenticated()‘ method to check whether the user is logged in or not .
If the user hasn’t logged in then should redirect to the /login page and once the user has entered his login credentials correctly redirect to the particular requested page.

The problem is if the user is not logged in then should redirect to login page. In this case the URL gets changed . We need to redirect back to the previous URL once the user is logged in. How can i achieve this? The URL ‘m calling is not a static URL. The parameters in the URL changes. I’m searching for some built in methods in Django to achieve this..

Does some have a better idea to solve this.

Thanks in advance.

  • 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-06-18T00:09:43+00:00Added an answer on June 18, 2026 at 12:09 am

    The default implementation of login_required accepts a next parameter which will cause the user to redirect to that URL after successful login.

    https://docs.djangoproject.com/en/dev/topics/auth/default/#the-login-required-decorator

    But of course you can recreate this functionality with a few lines.. in your login view, check for the presence of a get parameter called next or redirect_url, then redirect to it upon successful login.

    The view sending the user to the login page should simply append `'?next=%s' % request.path

    Simple as that.

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

Sidebar

Related Questions

I have a requirement where in I have to display a particular value from
I have a requirement wherein I need to display on a User form, a
I have a requirement where I ask user for confirmation and also display messages.
I have the fllowing requirement, I have a model called Task to display user
I have a requirement where i need to display a aspx page say login.aspx
We have a requirement to display bank routing/account data that is masked with asterisks,
I have a requirement to display a particular colour representation dependant upon data. At
We have a requirement where the web page displays all the records from joining
I'm building an asp.net page that is designed to display links for a user
I have a client that has a requirement to display PDFs directly within a

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.