views:

40

answers:

1

Is there a way to check if a template tag exists before using the template tag?

In other words, I would like to be able to do something like this:

{% load my_custom_tags %}
...
{% ifloaded my_custom_tags %}
  {% some_custom_tag %}
{% endifloaded %}
A: 

You could write your own, custom tag, that would check, if loaded tag is in the current context.

Here are docs: http://docs.djangoproject.com/en/dev/howto/custom-template-tags/

gruszczy