I have no idea, but it only took me a few minutes to create a filter
you can put in some templatetags module:
from django import template
from django.conf import settings
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter
@stringfilter
def installed(value):
apps = settings.INSTALLED_APPS
if "." in value:
for app in apps:
if app == value:
return True
else:
for app in apps:
fields = app.split(".")
if fields[-1] == value:
return True
return False
Assuming that you named this file "installed.py" then your template
can do this:
{% load installed %}
{% if "django.contrib.sites"|installed %}
and so forth
If the string you supply (or the string yielded by your variable) has
a dot in it ("."), then the full name must match. Otherwise the filter
will just check the last component of the name. (You can edit that out
of the filter if you don't like that behavior.)
{{ "admin"|installed }}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---