soc/templates/README.templates
changeset 34 14c266e01a56
parent 3 962da9e1065d
equal deleted inserted replaced
33:616855b101b5 34:14c266e01a56
       
     1 TEMPLATE NAMESPACES
       
     2 
     1 Templates are placed in a "namespace" subdirectory in the templates directory,
     3 Templates are placed in a "namespace" subdirectory in the templates directory,
     2 since the templates directory will be added to the Django templates search
     4 since the templates directory will be added to the Django templates search
     3 path.  This allows other packages to extend existing templates without "hiding"
     5 path.  This allows other packages to extend existing templates without "hiding"
     4 the original template.  For example, a template in another Melange application
     6 the original template.  For example, a template in another Melange application
     5 can extend a template in the SoC framework like this:
     7 can extend a template in the SoC framework like this:
     6 
     8 
     7   {% extends 'soc/some_existing_template.html %}
     9   {% extends 'soc/some_existing_template.html' %}
     8 
    10 
     9 without "hiding" the some_existing_template.html for other uses, even if the
    11 without "hiding" the some_existing_template.html for other uses, even if the
    10 derived template is also named some_existing_template.html.
    12 derived template is also named some_existing_template.html.
    11 
    13 
    12 So, please do not put any templates in this soc/templates directory, but only
    14 So, please do not put any templates in this soc/templates directory, but only
    14 
    16 
    15 Different Melange applications should also follow this pattern, to promote
    17 Different Melange applications should also follow this pattern, to promote
    16 sharing of templates between applications as well.  For exmample, the GSoC
    18 sharing of templates between applications as well.  For exmample, the GSoC
    17 Melange application should place its templates in gsoc/templates/gsoc.
    19 Melange application should place its templates in gsoc/templates/gsoc.
    18 
    20 
       
    21 MODEL/VIEW TEMPLATE NAMING
       
    22 
       
    23 View templates are usually named some_view.html for a corresponding someView()
       
    24 function and SomeViewForm form class.  Since SomeView is likely to be a common
       
    25 View name for multiple Models, Model-specific templates should be placed in
       
    26 soc/<model> sub-directories.  For example, the template used by the Profile
       
    27 view for the Person Model belongs in soc/person/profile.html.
       
    28