On 16 Sty, 20:31, "Aaron C. de Bruyn" <goo...@darkpixel.com> wrote: > Am I missing an easy way to check if an application is installed > so I can make decisions in a template? > > I have an application that currently requires the comments framework > and django-attachments. > > I would rather make them optional depending on the functionality needed > by the user/hoster of my app. > > I don't see a way in the templates to say something like: > {% if installed django.contrib.comments %} > display the comment form > {% endif %} > > I would rather not have 5 different templates for the same page, each > one with a different combination of possible installed applications along > with views to figure out which of the templates to load. >
AFAIK there is no such feature, but I think you could write template context processor exposing necessary flags to templates. -- Tomasz Zielinski http://pyconsultant.eu
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.