Hello In order to find more about django i proceeded to try creating templatetags. I decided to follow custom templatetag examples at djangoproject and djangobook (they are slightly different in both compliation and renderer part).
In any case the outcome is that the example described there does not work for me. I followed it step py step: I had one app with one model, so i thought, lets add templatetags to this one, since it could benefit form it. I created templatetags folder and created __init__.py and arts_tag.py file in that folder. This is the content of arts_tag.py file - pretty much 1 to 1 from http://docs.djangoproject.com/en/dev/howto/custom-template-tags/ from django import template import datetime register = template.Library() class CurrentTimeNode(template.Node): def __init__(self, format_string): self.format_string = format_string def render(self, context): return datetime.datetime.now().strftime(self.format_string) def do_current_time(parser, token): try: # split_contents() knows not to split quoted strings. tag_name, format_string = token.split_contents() except ValueError: raise template.TemplateSyntaxError, "%r tag requires a single argument" % token.contents.split()[0] if not (format_string[0] == format_string[-1] and format_string[0] in ('"', "'")): raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name return CurrentTimeNode(format_string[1:-1]) register.tag('current_time', do_current_time) And i have this in my view : {% extends "front/index.html" %} {% block arts %} {% lorem 3 p %} {% load arts_tag %} <p>The time is {% current_time "%Y-%m-%d %I:%M %p" %}.</p> {% endblock %} And it does not work. Alan --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---