Thursday, February 10, 2011

Django : How can I see what custom tags have been defined?

I'm having trouble with a custom tag in Django.

Is there any way I can see a list of what custom tags have been defined and are currently registered?

  • To list all currently active templatetags in django, execute the following in shell:

    from django import template
    for library in template.builtins:
        library.tags
    

    This code basically loops through the django template libraries and print the tags attached to them, thereby showing the names for all template tags currently being used by django and also give you access to their respective functions.

    From tarequeh
  • The admin docs will show them all (I believe, need to double check) Here is a link telling you how to turn on admin docs in 1.0

    Add django.contrib.admindocs to your INSTALLED_APPS list. Then add (r'^admin/doc/', include('django.contrib.admindocs.urls')), to your URL Conf file.

    From Raisins

0 comments:

Post a Comment