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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:26:48+00:00 2026-05-30T13:26:48+00:00

Is it possible to create a django template that can be used (nested) inside

  • 0

Is it possible to create a django template that can be used (nested) inside of another django template? I know of the extends command, but I don’t think that is what I’m looking for. Maybe I just don’t know how to make it work for this situation. Let me give an example.

It is common in most webapps to display the user’s login status, I’m looking for a way to put the logic for this (with the corresponding “Welcome Mr. Foo” and “Need to sign up?”) into a small template, like this:

loginstatus.html

{% if LoggedIn %}
    Message message link link
{% else %}
    Other message different link
{% endif %}

Now, I figure I’ll have to call the rendering engine and store this output into a variable, then pass that to the base template when I render it, so that my base template looks like this:

index.html

<html>
  <head>
  </head>
  <body>
    <div id="Header">{{ LoginStatus }}</div>
  </body>
</html>

Now, I know this is a pretty lame example, it only saved me 5 lines, but I envision doing this for creating a Navigation bar based on the user’s role, displaying a news feed with regard to the users position or selected interest, etc.

So, in short, is it possible (because I haven’t been able to make it work how I envision it) to pre-render a django template and then include that rendered html into another django template?

I don’t think it matters, but I am working with Google App Engine also, if that changes anything.

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

    For that particular example, you can use the include tag to include a snippet.

    For the nav bar and news feed, custom template tags – specifically, inclusion tags – would be more appropriate.

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

Sidebar

Related Questions

It's possible to create digrams in SQL Server 2000 that can be useful to
Is it possible to create a html file that can be loaded from jQuery
Is it possible to create a Django template tag which evaluates to a boolean?
I can create a form with Django that has a mysql background. I wonder
I don't know whether it's possible, but I'd like to be able to write
I know that it's possible to have a template filter return a SafeData instance
Hi it'd like to know if it's at all possible create a parametric equalizer
Is it possible to create a trigger that will not be in a transaction?
Is it possible to create Selenium tests using the Firefox plugin that use randomly
I'm using Django to create a site that provides a separate web UI for

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.