Hi,
I have a project with the following structure:
project
---> templates
--->myapp
--->templates
--->templatetags
I defined a custom tag called 'categories_list' as follow:
categories_list.py (located in myapp/templatetags)
-----------------------------------------------------------------------------
from django import template
from project.myapp.models import Category
register = template.Library()
@inclusion_tag('categories.html')
def get_categories():
categories = Category.objects.all().order_by('name')
return {'categories': categories}
Now I want to use this custom tag in homepage.html as follow:
homepage.html (located in project.templates)
-------------------------------------------------------------------
{% extends "base.html" %}
{% block sidebar %}
{% categories_list %}
{% endblock %}
The error is:
------------------------------------------------------------------------
Request Method: GET
Request URL: http://localhost:8000/
Exception Type: TemplateSyntaxError
Exception Value: Invalid block tag: 'categories_list'
Exception Location:
E:\bogota\python241\lib\site-packages\django\template\__init__.py in
invalid_block_tag, line 300
My application is registered in the INSTALLED_APPS.
Django version: SVN
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---