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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T15:19:43+00:00 2026-06-05T15:19:43+00:00

i have a django template – one that is normally loaded via a standard

  • 0

i have a django template – one that is normally loaded via a standard get request. However, i would also like to use this template for an ajax get.

I know i can use request.is_ajax to distinguish the call, and thus work out which page i should serve – what i don’t know is how to avoid replication.

The problem is, the page extends a base htm file – one that has all the bells and whistles (you know, header, menu et al). I don’t want this to appear in the ajax page though! What i’d like there is for the page to appear, not extending base htm

I can only think that perhaps i have two files – one that has just the contents (ajax version) and another that extends base htm, and somehow imports (not extends) the first file…

any ides how i’d do the above, or how i am meant to solve this generally?

  • 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-06-05T15:19:44+00:00Added an answer on June 5, 2026 at 3:19 pm

    In addition to @Daniel response, you can use yesno template filter if you have request in context processors, e.g.

    {% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
    

    This line should be in every template you use for both page and ajax content.

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

Sidebar

Related Questions

I have a Django template that I want to extend in multiple places. In
I have a django template which extends the base template that has code to
say I have the following list that I provide to a django template stuff=
I have a django template that looks like this: <head> <script src=http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js type=text/javascript></script> <script
I have a form in a Django template. I am aware that I can
I have a datetime value that is available in a django template. I am
I have recently found out that Smarty, differently from Django template engine, does not
I'm looking for a Django template filter that turns a multi-line construction into one
I have a Django template that contains a Javascript function, like so: <a class
I have an HTML django template page that is both RTL and LTR (depends

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.