List Info

Thread: Custom templatetags are ignored. Why ?




Custom templatetags are ignored. Why ?
user name
2006-03-30 06:54:43
Hi everyone

I wrote a small templatetags library (just one tag), put it
into
existing app directory (into subdirectory templatetags),
added
__init__.py there but after I added to my templates:
{% load "news_tags" %}
{% latest_news %}
django shows me an error:
'"news_tags"' is not a valid tag library:
Could not load template
library from django.templatetags."news_tags", No
module named
"news_tags"

After a bit of research I found that my templatetags dir has
__init__.pyc file and it tells me that django tried to
include this
directory but my news_tags.py file has no .pyc

Where may I be wrong ?


P.S. the idea is to put 2 latest news items on all pages
using custom
template tag in base.html (base template)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Custom templatetags are ignored. Why ?
user name
2006-03-30 07:08:36
ak wrote:
> After a bit of research I found that my templatetags
dir has
> __init__.pyc file and it tells me that django tried to
include this
> directory but my news_tags.py file has no .pyc

Sounds like you have a syntax error in news_tags.py.  Try
importing it 
within a Python shell.  Basically:

python manage.py shell
 >>> from myproject.myapp.templatetags import
news_tags

-- 
--Max Battcher--
http://www.worldmaker.net/

"I'm gonna win, trust in me / I have come to save
this world / and in 
the end I'll get the grrrl!" --Machinae Supremacy,
Hero (Promo Track)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Custom templatetags are ignored. Why ?
user name
2006-03-30 07:03:52
Sorry guys it was my stupidity 
I should have written
 {% load news_tags %} 
instead of
 {% load "news_tags" %}


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )