#14831: Django Template Style Guide
-------------------------------------+-------------------------------------
               Reporter:  DrMeers    |          Owner:  nobody
                   Type:  New        |         Status:  new
  feature                            |      Component:  Documentation
              Milestone:             |       Severity:  Normal
                Version:  1.2        |       Keywords:  template, style,
             Resolution:             |  format
           Triage Stage:  Accepted   |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
Changes (by DrMeers):

 * ui_ux:   => 0
 * easy:   => 0


Comment:

 I think much of Gabriel's suggestions here make good sense. Though:

 * I think `{% load A B C %}` is OK; loading in templates is simpler than
 importing in python since there are no relative imports, from x import y,
 etc.
 * I think 4-spaces is too much; in python, nesting can (and should) be
 avoided; in HTML, deep nesting is unavoidable. I'd therefore advocate
 2-space indentation or tabs (the width of which can be configured by your
 editor)

 I personally also indent template tags and HTML tags alike; e.g.
 {{{
   <ul>
     {% for x in y %}
       <li>{{ x }}</li>
     {% endfor %}
   </ul>
 }}}
 (though this obviously doesn't produce terribly pretty HTML, if anyone
 cares. I prefer pretty templates.)

 This is dangerous bikeshedding territory, but it seems sensible to have a
 standard within core code, and would also allow the production of django-
 template emacs modes, TextMate bundles, etc.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/14831#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to