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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:43:19+00:00 2026-05-27T04:43:19+00:00

I implemented the user login/registration using Django’s authentication system but hit the wall and

  • 0

I implemented the user login/registration using Django’s authentication system but hit the wall and hopefully someone can help me.

This website is using django-localeurl and is presently running in 3 languages.

I’m having problems passing the login redirect to the right language.
What I want to do is pass the current language to the LOGIN_REDIRECT_URL variable (in settings.py), so that instead of having:

LOGIN_REDIRECT_URL = '/accounts/my_account/'

I’d have something like:

LOGIN_REDIRECT_URL = '/%s/accounts/my_account/' % request.LANGUAGE_CODE

which of course doesn’t work because I’m not passing requests to settings.py.

Is there a really really easy and smart way to do this? It always defaults to English and that’s a big problem. If a user is viewing the site in Spanish, once they login they’re redirected to English :/

I have languages setup like this:

gettext = lambda s: s
LANGUAGES = (
    ('pt', gettext('Portuguese')),
    ('es', gettext('Spanish')),
    ('en', gettext('English')),
)

and

LANGUAGE_CODE = 'en'

because the admin needs to be in English.

Can anyone help?

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-27T04:43:19+00:00Added an answer on May 27, 2026 at 4:43 am

    For my own projects of that kind, I use my own login_redirect decorator instead of the one provided by Django, which always sent me to the static url defined in settings.py. My i18n decorator looks like that:

    def i18n_login_required(function):
        def wrap(request, *args, **kwargs):
            if not request.user.is_authenticated():
                return HttpResponseRedirect('/%s/accounts/login/?next=%s' % (get_language(), request.GET.get('next', urlquote(request.get_full_path()))))
            return function(request, *args, **kwargs)
        wrap.__doc__=function.__doc__
        wrap.__name__=function.__name__
        return wrap
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented a registration/login/authentication system using this Django guide . But, how would
I created a django application with a user login/registration page. I am trying to
I am trying to implement a registration and login system for my django app
I just implemented a remember me feature for a user login on a website.
On my website I have a user login system, when they login they are
I'm trying to set up a simple login using AuthLogic into my User table.
I want to create a login page, it can easy implement using Ruby on
I want to implement the user authentication and login page in ASP.NET, I want
I want the login activity to start when the user starts the app but
I have an asp.net login control and I have implemented the user name to

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.