Problem With Templatetags
Hi All,
I am using templatetags to create one tag.. I created the folder
templatetags and created 2 files in it.. __init__.py which is empty
and another temp_tags.py.. where i put one method
temp_tags.py
====================
from django import template
register = template.Library()
register.filter('lower', lower)
def lower(value): # Only one argument.
# "Converts a string into all lowercase"
return value.lower()
=========================
template2.html
=========================
{% load temp_tags %}
This will print my name in lowercase: {{ name|lower }}
============================
I ve not inserted anything in setting.py regarding templatetags and I
am getting this error
=============================
TemplateSyntaxError at /view2/
'temp_tags' is not a valid tag library: Template library temp_tags not
found, tried
django.templatetags.temp_tags,django.contrib.admin.templatetags.temp_tags
Request Method: GET
Request URL: http://localhost:8000/view2/
Django Version: 1.3
Exception Type: TemplateSyntaxError
Exception Value:
'temp_tags' is not a valid tag library: Template library temp_tags not
found, tried
django.templatetags.temp_tags,django.contrib.admin.templatetags.temp_tags
Exception Location: /usr/local/lib/python2.6/dist-packages/django/
template/defaulttags.py in load, line 1054
Python Executable: /usr/bin/python
Python Version: 2.6.4
================================
Please Help....
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home