app/soc/templates/README.templates
author Pawel Solyga <Pawel.Solyga@gmail.com>
Sat, 22 Nov 2008 22:44:02 +0000
changeset 568 6713617751b4
parent 529 7c5ec72cdcf1
permissions -rw-r--r--
Remove inheritance from PolyModel in Answer and Linkable model. Replace PolyModel inheritance with base.ModelWithFieldAttributes. A little explanation why we are trying to get rid of PolyModel. We decided to use PolyModel in order to get support for model inheritance in App Engine, however as we know this was a hacky workaround which added inheritance_line property to each model. Recent commits which added Linkable model caused our data viewer in admin console to show only one model "Linkable" since all of the classes inherited from it. Basically datastore viewer was useless plus we had a really big mess in datastore since everything was of one kind (Linkable). It's almost like creating one huge table in SQL database. Upcoming commits will eliminate all usage of PolyModel and finally remove PolyModel from our repository. We are still using inheritance however this doesn't modify how models are saved in data store so basically it's like copy and paste of properties from parent models. Patch by: Pawel Solyga, Sverre Rabbelier
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
     1
TEMPLATE NAMESPACES
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
     2
3
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     3
Templates are placed in a "namespace" subdirectory in the templates directory,
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     4
since the templates directory will be added to the Django templates search
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     5
path.  This allows other packages to extend existing templates without "hiding"
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     6
the original template.  For example, a template in another Melange application
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     7
can extend a template in the SoC framework like this:
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
     8
34
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
     9
  {% extends 'soc/some_existing_template.html' %}
3
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    10
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    11
without "hiding" the some_existing_template.html for other uses, even if the
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    12
derived template is also named some_existing_template.html.
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    13
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    14
So, please do not put any templates in this soc/templates directory, but only
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    15
place them in the soc/templates/soc "namespace" subdirectory.
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    16
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    17
Different Melange applications should also follow this pattern, to promote
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    18
sharing of templates between applications as well.  For exmample, the GSoC
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    19
Melange application should place its templates in gsoc/templates/gsoc.
962da9e1065d Add a "namespace-subdivided" Django templates directory for the SoC
Todd Larsen <tlarsen@google.com>
parents:
diff changeset
    20
34
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    21
MODEL/VIEW TEMPLATE NAMING
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    22
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    23
View templates are usually named some_view.html for a corresponding someView()
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    24
function and SomeViewForm form class.  Since SomeView is likely to be a common
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    25
View name for multiple Models, Model-specific templates should be placed in
529
7c5ec72cdcf1 Replace nick_name and its variants with public_name. Remove the
Todd Larsen <tlarsen@google.com>
parents: 54
diff changeset
    26
soc/<model>/<view> sub-directories.
34
14c266e01a56 Fix a typo in the {% extends %} example and add a section on Model-specific
Todd Larsen <tlarsen@google.com>
parents: 3
diff changeset
    27