Django custom assignment_tag does not get executed
django, django-1.5, django-1.6, django-templates
Solution
OK, I should have pasted the code as I really have it in my app. I edited the profile.html part above to reflect the actual situation. The issue was that the tags and variables are only executed between `{% block foo %}` and `{% endblock foo %}`. So with the following `profile.html` template it works:
{% extends "website/base.html" %}
{% load getattribute %}
{% block content %}
{% mytag "user.email" as vari %}
{{ vari }}
<p> Rest of the page. </p>
{% endblock content %}
Problem
I try to make my own assignment template tag in Django 1.6 (edit: I also tried it with 1.5.5 w/o success) but I can't get it to do anything. In `templatetags/getattribute.py` I have: ``` from django import template import logging register = template.Library() logger = logging.getLogger('wwwcid.website.debug_console') #@register.assignment_tag def mytag(context, context_variable): raise template.TemplateSyntaxError("buuuuuuuuuuuuuuus") logger.debug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!") print "teeeeeeeeeeeeeeeeeeeest" return 'tpppppppppppppppppppppeee' register.assignment_tag(mytag, takes_context=True) ``` In my template `profile.html` I have: ``` {% extends "website/base.html" %} {% load getattribute %} {% mytag "user.email" as vari %} {{ vari }} {% block content %} <p> Rest of the page. </p> {% endblock content %} ``` But this tag does not work. No error is raised (even if I raise it myself), no logging output, no print, no return, nothing. Even if I register the tag w/o the takes_context=True, say just `@register.assignment_tag` it does not work. What am I doing wrong here? Thanks for your help!