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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T00:24:25+00:00 2026-05-16T00:24:25+00:00

In my template, I have the following: <ul class=tabbed id=network-tabs> {% if user.is_authenticated %}

  • 0

In my template, I have the following:

        <ul class="tabbed" id="network-tabs">
            {% if user.is_authenticated %}
            <li><a href="{% url acct-my-profile %}">My Account</a></li>
            <li><a href="{% url acct-logout %}">Log Out</a></li>
            {% else %}
            <li><a href="{% url acct-login %}">Log in</a></li>
            <li><a href="{% url acct-register %}">Register</a></li>
            {% endif %}
        </ul>

It seems to work fine, unless the page been created has a @login_required decorator, in which case the page works fine but the navigation appears as if the user is not logged in, even when they are.

  • 1 1 Answer
  • 1 View
  • 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-16T00:24:26+00:00Added an answer on May 16, 2026 at 12:24 am

    You should check your view function to see where the user variable is coming from. Unless you’re specifically passing user into the context from the view, that’s your problem.

    You do have access to request.user, though, and that will always return true in a template rendered from a view that has the @login_required decorator.

    The reason I can tell you for certain that there’s nothing wrong with the decorator, though, is that in the code for User and AnonymousUser (located in django.contrib.auth.models) the is_authenticated method strictly returns true for User and false for AnonymousUser. The decorator does not and cannot change that. And what that means is that your template isn’t actually getting a User object where you’re checking user.

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

Sidebar

Related Questions

I have the following models: class UserProfile(models.Model): user = models.ForeignKey(User, unique=True, related_name='profile') starred_authors =
I have the following class definition: template<typename QueueItemT> class QueueBC { protected: QueueBC() {}
I have the following class: template <typename T> class matrix { private: int _n;
I have the following code: class TimeOutException {}; template <typename T> class MultiThreadedBuffer {
I have the following template method declared in my interface: class IObjectFactory { public:
I have the following use case: There's a class called Template and with that
I have the following code: template <class T> struct pointer { operator pointer<const T>()
I have the following pattern: template <int a, int b> class MyClass { public:
I have the following templated function... template< class T > T *create_object( lua_State *L
I have following class: template <size_t size> class Araye{ public: Araye(int input[]){ for (int

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.