I have created a new template "mytemplate.html" extending "two_column_body.html". It was working until I try to use custom tags. I have created the file askbot/templatetags/mytags.py containing for instance :
@register.simple_tag
def mytag():
...
In "mytemplate.html" I add :
...
{% load mytags %}
<label>{% mytag %}</label>
...
and I get this messages in the logs :
/usr/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-08-10 14:31:34,457 MSG: pagesize.py:process_exception:44 <class 'jinja2.exceptions.TemplateSyntaxError'>
/usr/local/virtualenv/askbot/lib/python2.6/site-packages/askbot/middleware/pagesize.py TIME: 2011-08-10 14:31:34,457 MSG: pagesize.py:process_exception:45 Encountered unknown tag 'mytag'. Jinja was looking for the following tags: 'endblock'. The innermost block that needs to be closed is 'block'.
Any idea?
In Jinja2 template tags are harder to add, but almost in all cases they can be replaced with a macro.
http://jinja.pocoo.org/docs/templates/#macros
There are lots of macros in file askbot/skins/default/templates/macros.html and examples of use are in many places, for example in a template question.html.
Do you need to add extra context variables, right now you can add them via a custom template context processor, we can also add extra_context parameters to the views. Could you explain in more detail what you are trying to do?
Create your Q&A site at askbot.com. Managed Askbot hosting at just $15/mo. Dedicated hosting, support contracts, consulting services.
create your Q&A siteAsked: 2011-08-10 07:56:17 -0500
Seen: 115 times
Last updated: Aug 10 '11
How to perform Template() on askbot setting?
Why askbot template base.html has become the default base template?
Where in the Askbot code would I find the text asking you to give a descriptive answer?
sharing templates between askbot and our own django app
translation works only partially in templates
Where is the template for the tag input field?
Copyright Askbot, 2010-2011. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.