Hi everyone,
I'm working on a Django application, Telemeta, which is currently deployed in 4
projects. Each of these projects have special requirements in regard to
presentation and data display, so that the application templates need to be
slightly customized.
For this purpose I have used template inheritance as shown below.
In the application:
telemeta/templates/telemeta_default/somepage.html:
{% extends "telemeta/base.html" %}
{% load telemeta_utils %}
{% block content1 %}
[...]
{% endblock %}
{% block content2 %}
[...]
{% endblock %}
telemeta/templates/telemeta/somepage.html:
{% extends "telemeta_default/somepage.html" %}
And in the project:
project/templates/telemeta/somepage.html:
{% extends "telemeta_default/somepage.html" %}
{% block content1 %}
(Customize content1 here...)
{% endblock %}
With this mechanism, when Django tries to resolve telemeta/somepage.html, it
uses the project specific template, and ignore the default one. However, it can
still inherit from the /real/ default template, which is located in
telemeta_default/somepage.html. This way, there is no need to replicate the
whole default template to customize it.
But, do you see a way to avoid those single-line "templates" located in
telemeta/templates/telemeta?
--
Olivier Guilyardi / Samalyse
--
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.