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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:35:18+00:00 2026-05-30T16:35:18+00:00

This view function: @login_required def dashboard(request): from myproject.myapp.models import UserProfile k = UserProfile.objects.get( user=request.user.pk

  • 0

This view function:

@login_required 
def dashboard(request):
    from myproject.myapp.models import UserProfile
    k = UserProfile.objects.get( user=request.user.pk ).known

    return render_to_response('dashboard.html', {'KNOWN': k, , context_instance=RequestContext(request))

Passes to this template:

{% if user.is_authenticated %}
    {{ user.username }}
{% else %}
    Login link
{% endif %}
    {{ KNOWN }}
  1. I have already logged in.
  2. Page does not redirect to LOGIN_URL (so therefore @login_required thinks im logged in I guess)
  3. {{ KNOWN }} renders perfectly OK
  4. {{ user.username }} doesn’t appear

How is this possible? Surely if login_required works, and it managed to grab KNOWN, therefore user must exist somewhere?
How can I debug this?

🙂


UPDATE:
If I remove:

TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',)

From settings, it works.
However, by removing that, other pages which use {{ request.get_full_path }} in templates don’t load.
Eeek.


UPDATE 2:

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.core.context_processors.request",)

If you just add the request line on its own, it disables all the others which are defaults. D’Oh!


UPDATE 3: Thought that would fix it, unfortunately still not working.


UPDATE 4: Spotted typo elsewhere, can confirm that Mark Lavin’s answer fixed it 🙂

  • 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-30T16:35:20+00:00Added an answer on May 30, 2026 at 4:35 pm

    If you are setting TEMPLATE_CONTEXT_PROCESSORS = ('django.core.context_processors.request',) then you are removing all the default context processors in particular django.contrib.auth.context_processors.auth which adds user to the context. You should instead use

    TEMPLATE_CONTEXT_PROCESSORS = (
        "django.contrib.auth.context_processors.auth",
        "django.core.context_processors.debug",
        "django.core.context_processors.i18n",
        "django.core.context_processors.media",
        "django.core.context_processors.static",
        "django.contrib.messages.context_processors.messages",
        "django.core.context_processors.request",
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a function based view that looked like this: def account_details(request, acc_id): account
I have a view function: @login_required def myview(): # do something # respond something
View this code: function testprecision(){ var isNotNumber = parseFloat('1.3').toPrecision(6); alert(typeof isNotNumber); //=> string }
I have a Django view called change_priority. I'm posting a request to this view
I got a view that inherits : System.Web.Mvc.ViewPage<IEnumerable<MyProjects.Models.MyAccountWrapper>> In this view I list data
I have a codeigniter application.This is my code in view page. function click_next(){ var
I created a new View (LogView) in Infrastructure.Module project. This view will be used
I have a view ViewUserControl<SearchViewData> where SearchViewData: CommonViewData In this view I thus have
I'm having a memory problem related to UIImageView. After adding this view to my
Having this XML view: <?xml version=1.0 encoding=utf-8?> <LinearLayout android:id=@+id/myScrollLayout android:layout_width=fill_parent android:layout_height=fill_parent android:orientation=vertical xmlns:android=http://schemas.android.com/apk/res/android> <ScrollView

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.