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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:18:16+00:00 2026-05-20T02:18:16+00:00

I use template inheritance in django. Currently have frame.html and book_detail.html book_detail.html extends frame.html

  • 0

I use template inheritance in django.

Currently have frame.html and book_detail.html

book_detail.html extends frame.html and I have books_tags.py

# In frame.html
{% load books_tags %}
{% book_list %} # using a tag from books_tags.py



# In books.html
{% extends frame.html %}
{% block content %}
   {% book_list %} # I want to use this from books_tags.py also
{% endblock %}

When I try to use book_list from the same books_tags.py, it gives me syntax error.
Alternately, when I put {% load books_tags %} inside book_detail.html first, it again still gives me syntax error.

Invalid block tag: ‘book_list’,
expected ‘endblock’ or ‘endblock
content’

Is there any way I can use same template tags in multiple inherited templates?
Or do I need to create frame_tags.py and book_detail_tags.py with same def in it?

Since default template filters in django works in multiple inheritance, I’m guessing it should work, but don’t know how to get by syntax error.

Thank you.

== UPDATE ==

Add template_tag inside {% block content %} in books.html again.

# In books.html
{% extends frame.html %}
{% block content %}
   **{% load books_tags %}**
   {% book_list %} # I want to use this from books_tags.py also
{% endblock %}
  • 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-20T02:18:16+00:00Added an answer on May 20, 2026 at 2:18 am

    You can use the same template tags in multiple templates, but you have to call {% load books_tags %} in each file, even if there is an inheritance relationship between them.

    See https://docs.djangoproject.com/en/dev/topics/templates/#custom-libraries-and-template-inheritance

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

Sidebar

Related Questions

Coming from a background in Django, I often use template inheritance, where multiple templates
I'm going a little nuts trying to figure out how to use template inheritance
I'm trying to use inheritance among classes defined inside a class template (inner classes).
Am working with django 1.3 and doing some template inheritance. My /static/ settings path
I have an Rails 3.1 app that uses template inheritance and that works great:
In Play Framework , Can one use the #{extends} tag recursively? I.e., in a
I use Template Toolkit to generate views of pages in Catalyst. To do some
I'm wondering how one could use template databinding to accomplish what the following code
I'd like to be able to use template deduction to achieve the following: GCPtr<A>
I come from a C++ background where I can use template mixins to write

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.