views:

222

answers:

1

for some reason, templatetags do not render in templates for django admin.

with this snippet from: http://docs.djangoproject.com/en/dev/ref/templates/api/?from=olddocs#shortcut-for-simple-tags

{% if is_logged_in %}Thanks for logging in!{% else %}Please log in.{% endif %}

when placed in admin index.html, if a user is logged in, it shows "Please log in"

same with templatetags, can not get any app ones to show, do anything. there is no error/they do not get processed either

+2  A: 

That's only an example, the is_logged_in variable is not actually defined in any templates unless you put it in the context.

If you added that line and got Please log in. it does mean that the tag is rendering. If it fails the if and goes to the else it is clearly being run. You need to find something in the template you can actually use for the if case, though. I haven't messed with the admin templates in newforms-admin, but depending if they use RequestContext and on which ContextProcessors you have enabled - you might be able to say {% if not request.user.is_anonymous %} ... or something similar.

Brett Hoerner
tried using custom templatetags examples on:http://docs.djangoproject.com/en/dev/howto/custom-template-tags/none seem to work, they do not show, nor are any errors