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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:42:41+00:00 2026-05-20T13:42:41+00:00

I have a few views and they all work good and all use templates

  • 0

I have a few views and they all work good and all use templates that extend one base template that outputs the core HTML, the header, footer, navigation and so on. Happy family.

now, I want to play with sessions on the pages and since you can’t get access to user’s session information from the template without actually passing it from the view (correct me where I’m wrong) I have two options:

  1. add session data to the rest of the bits I pass as context to HTML templates in views (not sure if this is a good way to go)

  2. somehow inherit all existing views from a view that will be always pushing context to templates being processed – this way I don’t have to worry about anything else I may want to add to my pages in the future – is this possible?

I’m very new to django and there may be other proper way of doing this – all your suggestions are much appreciated.

  • 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-20T13:42:42+00:00Added an answer on May 20, 2026 at 1:42 pm

    I think adding in a context processor is a very easy way to do this.

    You could either write your own or use this one:
    DJANGO.CORE.CONTEXT_PROCESSORS.REQUEST

    http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request

    Then you will have the request in your template, and could get to the session with request.session

    If you do that though, make sure that you pass the RequestContext along in your views to the templates, something like this:

    from django.template import RequestContext
    def some_view(request):
        # ...
        return render_to_response('my_template.html',
                              my_data_dictionary,
                              context_instance=RequestContext(request))
    

    Also modify your settings.py to add in the context processor

    TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
        "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 have a few asp views that I would like to switch between with
I have written a few apps for the iphone now, but they are all
I have a few view helpers that add JavaScript files when they're needed (for
I have few common views in most of my viewControllers . What I noticed
I have a few methods inside my view controller that load up for future
I have a view with a few checkboxes that can be selected or unselected.
In a word, how? I have a view controller that creates a few custom
This is a weird one. I am trying to use Views in MySQL (I'm
I have spent several days so far laying the ground work to use FastReport
I have a few nested view models with observable arrays and am unable 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.