badger17 напиша:
> At the moment I can only get it load tags from the current app, ie the
> one in which the template is being rendered, or from
> django.templatetags in the django install location. Is there a way to
> make it load tags for example from a different app?
>
> I have written an app for rating objects that is not tied to any
> specific models, but I seem to have to put the template tags in the
> app where I am using the tags instead of being able to import them
> from their own app directory. Hope this makes sense.
Are your templatetags in PYTHONPATH? When I use a custom tag I need to
import it in the view where I render the template.
The directory with your file where you put your tags should be in the
python path.
ex.
*views.py
# /home/example/ is in PYTHONPATH and there is a file
# /home/example/templatetags/mytags.py with the tags
from templatetags import mytags
def theview(request):
return render_to_response('template.html')
*template.html
{% load mytags %}
<b>Hello world.</b>
--
Glisha
The perfect OS, MS-DOS!
No patches, no root exploits for 21 years.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---