X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/ac6ebd8b38a46afb0b249574be71a276f95b6efa..6164c1b917297594aad253cd404240bfde9cef81:/philo/templatetags/embed.py diff --git a/philo/templatetags/embed.py b/philo/templatetags/embed.py index 7345f89..16f8092 100644 --- a/philo/templatetags/embed.py +++ b/philo/templatetags/embed.py @@ -1,3 +1,7 @@ +""" +The embed template tags are automatically included as builtins if :mod:`philo` is an installed app. + +""" from django import template from django.conf import settings from django.contrib.contenttypes.models import ContentType @@ -281,21 +285,26 @@ def parse_content_type(bit, tagname): except ValueError: raise template.TemplateSyntaxError('"%s" template tag expects the first argument to be of the form app_label.model' % tagname) try: - ct = ContentType.objects.get(app_label=app_label, model=model) + ct = ContentType.objects.get_by_natural_key(app_label, model) except ContentType.DoesNotExist: raise template.TemplateSyntaxError('"%s" template tag requires an argument of the form app_label.model which refers to an installed content type (see django.contrib.contenttypes)' % tagname) return ct -def do_embed(parser, token): +@register.tag +def embed(parser, token): """ The {% embed %} tag can be used in two ways. - To set which template will be used to render a particular model:: + First, to set which template will be used to render a particular model. This declaration can be placed in a base template and will propagate into all templates that extend that template. + + Syntax:: {% embed . with