Here is the solution I settled on for now. This is obviously not
optimally efficient because I have to hit the filesystem twice for
every page load. Does anyone know of a way to raise Http404 during
template rendering? I tried it with a TemplateResponse subclass but
ran into some problems with _
I have some legacy code that I used to dynamically load a template based on
url if it exists and render a 404 if it doesn't exist.
def content(request, template_name='index'):
try:
return direct_to_template(request, '%s.html' % template_name)
except TemplateDoesNotExist:
r
Hello
Could u share your code of the new template extends tag? I have very
similar problems here.
Kind Regards
Enoch Qin
On Nov 27, 5:58 pm, jorjun <[EMAIL PROTECTED]> wrote:
> OK, managed to do this in the end, by creating a new template tag and
> node derived from django.template.loader_tag.
OK, managed to do this in the end, by creating a new template tag and
node derived from django.template.loader_tag.ExtendsNode
overriding the get_parent method.
Now we have total white labeling of all our templates, including base
templates.
Django rocks.
On 27 Nov, 12:20, jorjun <[EMAIL PROTECT
I am trying to work out the best way to allow dynamic template
substitution based on RequestContext
Could anybody point me in the right direction? I don't know if I need
a new template loader, or I need to create new tags.
But in this case :
{% extends "myapp/base.html" %}
I would like it to l
5 matches
Mail list logo