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

  • Home
  • SEARCH
  • 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 4053200
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:25:01+00:00 2026-05-20T14:25:01+00:00

I want to create a reusable template (almost like a UserControl from the .NET

  • 0

I want to create a reusable template (almost like a UserControl from the .NET world) that I can apply in multiple places, something like:

{% for thing in things %}
    {% render_thing thing %}
{% endfor %}

Where render_thing is my custom inclusion tag. My Python code reads as follows:

def get_full_path(relative_path):
    return os.path.join(os.path.dirname(__file__), relative_path)

def render_thing(thing):
    return {'thing':thing }

register = template.create_template_register()
register.inclusion_tag(get_full_path('thing.html'))(render_thing)

Where thing.html is my little template. However, when I run this I get the error:

TemplateSyntaxError: Invalid block tag: 'render_thing'

What am I missing?

  • 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-20T14:25:02+00:00Added an answer on May 20, 2026 at 2:25 pm

    If you are using Django 1.2 templates, you will need to supply a Python module-style reference to your custom tag code rather than a file path.

    There’s a full description of the problem and the solution on my blog.

    EDIT:
    Sorry to be so high-level on you. Here’s a more step-by-step explanation:

    1. Put your custom tag code in a file, say my_custom_tags.py for the sake of example.

    2. take the .py file that your custom tag code lives in and put it in a subdirectory of your main AppEngine project directory, say customtags for the sake of an example.

    3. in that new subdirectory, create an empty file that has the name __init__.py
    4. in your AppEngine application’s main .py file, add this code:

      from google.appengine.ext.webapp import template
      template.register_template_library(‘customtags.my_custom_tags’)

    All of the custom tags defined in your custom tag library should now be available in your template files with no additional work.

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

Sidebar

Related Questions

I want to create a number of masked edit extenders from codebehind. Something like:
I'm trying to create a reusable UserControl in WPF that has a Label and
i want create something like link_to which can link to request for permission in
I want create for paging a usercontrol. How can I access properties in usercontrol.ascx
I want to create a function that performs a function passed by parameter on
I want to create a simple http proxy server that does some very basic
I want to create my Rails application with MySQL, because I like it so
How do I create a reusable library/module in XCode 3.2? What I want to
i wish to create a reusable ASP.NET MVC ViewUserControl which is strongly typed to
I'm looking to create a reusable function that will generate a random key with

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.