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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:38:08+00:00 2026-06-07T13:38:08+00:00

Trying to follow the Django Inclusion Tag documentation to create a custom template tag,

  • 0

Trying to follow the Django Inclusion Tag documentation to create a custom template tag, but getting a template syntax error on line 6: def types(Information).

from django import template

register = template.Library()

@register.inclusion_tag('edit.html')
def types(Information)
    informations = Information.objects.all()
    return {'informations': informations}

The templatetag.py file is within the /templatetags directory.

The model for Information:

class Information(models.Model):
    name = models.CharField(max_length=20)
    models = models.ManyToManyField('Model')

The template (edit.html):

{% load templatetag %}
<ul>
   {% for information in informations %}
      <li> {{ information }} </li>
   {% endfor %}
</ul>

Am I misunderstanding how to create the inclusion tag and objects? Thanks for any advice.

  • 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-07T13:38:11+00:00Added an answer on June 7, 2026 at 1:38 pm

    Well, not surprisingly, you have a syntax error. Function definitions, like anything that starts a block in Python, need to have a colon at the end:

    def types(information):
    

    Also note that for some reason you’ve named your argument Information, which will hide the class Information – whatever object you pass as the actual parameter will be used as the base for the objects.all() query, which is unlikely to work.

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

Sidebar

Related Questions

I'm trying to follow the django tutorial and create two tables where the unique
I am trying to create very first project using django but stuck at very
I'm trying follow a tutorial to create a custom USB driver in Linux and
Trying to create a Django app based off the tutorial but using a different
Iam new to django-haystack, and I am trying to follow the getting started guide.
I'm trying to follow the documentation to get started with celery, but running into
I'm trying to follow the Django tutorial (for v1.1) here . the problem that
So I was trying to follow http://developer.android.com/guide/topics/media/camera.html to create a simple app that captures
I am trying to create a simple view in Django & GAE, which will
Evening, Trying to follow the Django tutorial, as seen here, https://docs.djangoproject.com/en/dev/intro/tutorial01/ I run the

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.