app/soc/templates/README.templates
changeset 54 03e267d67478
parent 34 14c266e01a56
child 529 7c5ec72cdcf1
equal deleted inserted replaced
53:57b4279d8c4e 54:03e267d67478
       
     1 TEMPLATE NAMESPACES
       
     2 
       
     3 Templates are placed in a "namespace" subdirectory in the templates directory,
       
     4 since the templates directory will be added to the Django templates search
       
     5 path.  This allows other packages to extend existing templates without "hiding"
       
     6 the original template.  For example, a template in another Melange application
       
     7 can extend a template in the SoC framework like this:
       
     8 
       
     9   {% extends 'soc/some_existing_template.html' %}
       
    10 
       
    11 without "hiding" the some_existing_template.html for other uses, even if the
       
    12 derived template is also named some_existing_template.html.
       
    13 
       
    14 So, please do not put any templates in this soc/templates directory, but only
       
    15 place them in the soc/templates/soc "namespace" subdirectory.
       
    16 
       
    17 Different Melange applications should also follow this pattern, to promote
       
    18 sharing of templates between applications as well.  For exmample, the GSoC
       
    19 Melange application should place its templates in gsoc/templates/gsoc.
       
    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