app/soc/templates/README.templates
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sun, 19 Oct 2008 17:33:44 +0000
changeset 391 849aa913e9c8
parent 54 03e267d67478
child 529 7c5ec72cdcf1
permissions -rw-r--r--
Address comments to r844 and r845. Patch by: Pawel Solyga Review by: to-be-reviewed

TEMPLATE NAMESPACES

Templates are placed in a "namespace" subdirectory in the templates directory,
since the templates directory will be added to the Django templates search
path.  This allows other packages to extend existing templates without "hiding"
the original template.  For example, a template in another Melange application
can extend a template in the SoC framework like this:

  {% extends 'soc/some_existing_template.html' %}

without "hiding" the some_existing_template.html for other uses, even if the
derived template is also named some_existing_template.html.

So, please do not put any templates in this soc/templates directory, but only
place them in the soc/templates/soc "namespace" subdirectory.

Different Melange applications should also follow this pattern, to promote
sharing of templates between applications as well.  For exmample, the GSoC
Melange application should place its templates in gsoc/templates/gsoc.

MODEL/VIEW TEMPLATE NAMING

View templates are usually named some_view.html for a corresponding someView()
function and SomeViewForm form class.  Since SomeView is likely to be a common
View name for multiple Models, Model-specific templates should be placed in
soc/<model> sub-directories.  For example, the template used by the Profile
view for the Person Model belongs in soc/person/profile.html.