Re: [Django] #14831: Django Template Style Guide

2024-03-11 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  closed
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  template, style, | Triage Stage:  Ready for
  format |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * resolution:   => fixed
 * status:  assigned => closed

Comment:

 In [changeset:"f2c35249591d202ee544eadcaa9de4c255045692" f2c35249]:
 {{{#!CommitTicketReference repository=""
 revision="f2c35249591d202ee544eadcaa9de4c255045692"
 Fixed #14831 -- Extended template style guide in docs.
 }}}
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e2d74bf3c-52abf02d-9425-4181-a898-acdf08e97c05-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-03-11 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Ready for
  format |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_better_patch:  1 => 0
 * stage:  Accepted => Ready for checkin

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e2ca15fbf-578c8121-5b0c-4483-86dc-1dd70bd16f73-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-03-04 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Ryan Cheley):

 * needs_better_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e0c989a78-63bf6a75-ea3a-422c-8236-3370d5ba80a1-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-03-04 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Ryan Cheley):

 * has_patch:  0 => 1

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018e0c92b85f-7a8bbfe1-cd33-4686-ab83-44f10b831e94-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-03-01 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Baptiste Mispelon:

Old description:

> It would be nice to have a standard template style that should be
> followed. For example, I like to indent my Django templates by two
> additional spaces every time I enter a new HTML or template block. The
> Django core templates vary greatly in regards to style and indentation.
> Much of the time template readability is sacrificed in favour of
> attempting to preserve the "appearance" of the generated HTML code.
>
> Regardless of what is decided, it would be great to have at least some
> guidelines for templates added to
> http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style

New description:

 It would be nice to have a standard template style that should be
 followed. For example, I like to indent my Django templates by two
 additional spaces every time I enter a new HTML or template block. The
 Django core templates vary greatly in regards to style and indentation.
 Much of the time template readability is sacrificed in favour of
 attempting to preserve the "appearance" of the generated HTML code.

 Regardless of what is decided, it would be great to have at least some
 guidelines for templates added to
 https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /coding-style/#template-style

--
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018dfbc22acf-e52103a7-b203-47b5-9fce-0111b63a8abc-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-02-17 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Ryan Cheley):

 Post to forum made here https://forum.djangoproject.com/t/django-template-
 style-guide-ticket-14831/28177
-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018db7a2b245-dee4e290-bba4-41f8-b963-4619da9122e4-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-13 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 Looking at the `{% block ... %}` I have this to locate the occurences

 {{{
 find . -name "*.html" ! -path "./venv/*" -exec grep -En
 "\{%\s*block\s+\w+\s*%\}" {} + | awk -F: '$2 > 2 {print "Filename: " $1 ",
 Line number: " $2 ", Matched string: " $3}'
 }}}

 This returns 365 files in 37 directories.

 Further investigation will have to wait until next time though

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d041ed1d7-39eb973a-6bcc-45d0-914c-3c09ffca46ea-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-13 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 Replying to [comment:14 Ryan Cheley]:
 > I moved the `{% load log %}` from line 25 to line 3 and there weren't
 any NEW test failures. Once a standard is decided on this could
 potentially be moved to the top and it doesn't look like any negative
 impact would be introduced (from a testing perspective anyway).
 >
 > Next step is to create a Django app locally and see what happens

 App locally seems to be behaving as expected.

 Also, in reading the docs I was reminded that a `{% load ... %}` can have
 more than one template tag added, so the two outliers here can be moved up
 into a single `{% load ... }` command instead of multiple lines

 This means that

 * /django/contrib/admin/templates/admin/auth/user/change_password.html can
 have line 2 updated to `{% load i18n static admin_urls %}`
 * ./django/contrib/admin/templates/admin/index.html can have line 2
 updated to be `{% load i18n static log %}`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d040cbd72-25520f98-a4af-4c5a-9eae-d84c9c448cf3-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-13 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 I moved the `{% load log %}` from line 25 to line 3 and there weren't any
 NEW test failures. Once a standard is decided on this could potentially be
 moved to the top and it doesn't look like any negative impact would be
 introduced (from a testing perspective anyway).

 Next step is to create a Django app locally and see what happens

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d03fe4d80-2bf1857b-a5c2-4fdd-9a20-6737ee6a1006-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-13 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 Checking the `{% loads` using this bash command
 {{{
 find . -name "*.html" ! -path "./venv/*" -exec grep -En "\{% load" {} + |
 awk -F: '$2 > 2 {print "Filename: " $1 ", Line number: " $2 ", Matched
 string: " $3}'
 }}}
 returns the following results:

 * Filename:
 ./django/contrib/admin/templates/admin/auth/user/change_password.html,
 Line number: 3, Matched string: {% load admin_urls %}
 * Filename: ./django/contrib/admin/templates/admin/index.html, Line
 number: 25, Matched string: {% load log %}


 The first item is actually OK upon inspection as there are 2 `{% load ...
 }` statements in the file

 The second item `./django/contrib/admin/templates/admin/index.html` has
 `{% load log %}` on line 25. This was first added in commit
 
[https://github.com/django/django/blob/52f5c949e9b50ae3b0034d67f2d385219588aaf1/templates/admin/index.html
 52f5c9] so it's always been lower in the file.

 Next step is to determine if moving the line up will break anything

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d03f3a622-2a72d8a0-69fe-4860-bca8-6e6c3e4aca80-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-13 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 Checking the `{{% extends}}` using this bash command

 ```
 find . -name "*.html" ! -path "./venv/*" -exec grep -n "% extends" {} + |
 awk -F: '$2 > 1 {print "Filename: " $1 ", Line number: " $2 ", Matched
 string: " $3}'
 ```

 returns no results. It looks like the `{{% extends}}` is always at the top
 line of the `html` files

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018d03dd816f-b283c6a0-c6c6-43b0-ac33-c143037822fc-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-06 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 After reviewing the html files this is what I've found:

 False positives from the script above

 * `./contrib/admindocs/templates/admin_doc/bookmarklets.html` has inline
 javascript on line 22 which is the source of:

 ||= Count =||= Symbol =||
 || 2 || {al ||
 || 1 || {if ||
 || 1 || {re ||
 || 1 || {vi ||
 || 1 || {x= ||

 * `./contrib/admindocs/templates/admin_doc/template_filter_index.html`
 line 23 which is triggering the {"|. This seems to fall outside of the
 requirements for this ticket
 * `./contrib/admindocs/templates/admin_doc/template_tag_index.html` line
 23 which is triggering the {"|. This seems to fall outside of the
 requirements for this ticket
 * `./forms/jinja2/django/forms/widgets/multiwidget.html` line ` has `{%-`.
 Per the [https://jinja.palletsprojects.com/en/3.1.x/templates/#whitespace-
 control jinja2 docs] this is in place for whitespace control

 Files where the standard isn't being followed

 * `./views/templates/technical_500.html` on line 157 has
 `{{server_time|date:"r"}}`

 Based on these findings it seems that the docs that are currently written
 are being enforced.

 Next steps:

 - review `extends` and `load` tag placement
 - placement of HTML in `block`
 - indentation practices for code inside of `block`

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ce03efbba-420cae61-d9cf-4b12-b47c-3118680a0a57-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-06 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Ryan Cheley):

 I ran the following bash command (which is returning some false positives,
 for example `{al` is finding an inline javascrpt alert) to get a sense of
 what is current in the `django/django` directory

 {{{
 find django/django -type f -name "*.html" -exec grep -E
 "(\{\{[^}]*\}\})|(\{%[^%]*%\})" {} + | grep -o -E "\{.." | sort | uniq -c
 }}}

 This gives the following usages

 {{

 ||= Count =||= Symbol =||
 ||724 || {{ ||
 || 2 || {"| ||
 || 2 || {al ||
 || 1 || {if ||
 || 1 || {re ||
 || 1 || {vi ||
 || 1 || {x= ||
 || 1 || {{s ||

 {%

 ||= Count =||= Symbol =||
 || 2121 || {% ||
 || 1 || {%- ||

 For the items that don't conform to `{{` or `{%` I'll look more deeply at
 the occurrences and provide more context for them, but on initial review
 it seems that the preference / standard seems to be `{{` or `{%` followed
 by a space

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018cdfca14dd-d1eca040-15fb-43dc-b1ad-6d7ea9607462-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2024-01-02 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Natalia Bidart):

 Hello Ryan, thanks for going thru these old tickets to try to make a
 decision about them.

 Given that the ticket is already accepted, I would suggest to push this
 ticket forward by pursuing the 3 tasks detailed in the first comment (with
 the only caveat that the Django Forum would be preferred instead of the
 Django Developers list), which I agree are the first steps before making
 any docs changes:

 1. An overview of the various styles found in the current templates,
 2. A draft patch based on whatever the most common/best practice seems to
 be,
 3. A thread on the Django Forum to let folks debate the options.

 Looking forward to your forum post!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ccbe4f63e-f7c0c310-82d2-4544-b309-4e7f8c58ca0d-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

2023-12-31 Thread Django
#14831: Django Template Style Guide
-+-
 Reporter:  Simon Meers  |Owner:  Ryan
 |  Cheley
 Type:  New feature  |   Status:  assigned
Component:  Documentation|  Version:  1.2
 Severity:  Normal   |   Resolution:
 Keywords:  template, style, | Triage Stage:  Accepted
  format |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Ryan Cheley):

 * owner:  nobody => Ryan Cheley
 * status:  new => assigned


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018cc0d814f5-6c63a2ea-449a-462c-b005-10206e2085a9-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

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

 * cc: Ryan Cheley (added)


Comment:

 It looks like there hasn't been much movement on this ticket for a while,
 and the docs located
 [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /coding-style/#template-style here] haven't made any changes to the
 Template Section. I'm wondering if this is actually something that is
 still needed or not?

 If it is, I'm happy to try and gather consensus on what the docs should
 recommend.

 If not, perhaps we just mark the ticket as closed?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018cc0d7f831-e8e32a2c-9efc-45e9-b657-e1419251bc04-00%40eu-central-1.amazonses.com.


Re: [Django] #14831: Django Template Style Guide

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

 * cc: Tobias Kunze (added)


Comment:

 By now, there is a
 [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /coding-style/#template-style place] to add further template style guides
 (currently it only says to add one space between `{{` and the variable
 name. So we'd need a consensus on what a good template style would mean:
 Indented for template readability or for meaningful HTML indentation?
 Indented by two spaces or four?

 I'd be all for two spaces and indentation as proposed by
 [https://code.djangoproject.com/ticket/14831#comment:4 Simon].

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.215a1ddb12e7b8d0df99fa37d713e25a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #14831: Django Template Style Guide

2011-09-21 Thread Django
#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  |
-+-

Comment (by DrMeers):

 Actually you can use "from" syntax in the load tag, can't you; in those
 cases it certainly makes sense to keep them on separate lines. Though
 perhaps that isn't what Gabriel was advocating in the first place; on re-
 reading he may have been simply saying it shouldn't be on the same line as
 `{% extends %}` (which of course must be at the top).

-- 
Ticket URL: 
Django 
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.



Re: [Django] #14831: Django Template Style Guide

2011-09-21 Thread Django
#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.
 {{{
   
 {% for x in y %}
   {{ x }}
 {% endfor %}
   
 }}}
 (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: 
Django 
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.



Re: [Django] #14831: Django Template Style Guide

2011-04-04 Thread Django
#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  |
-+-
Changes (by anonymous):

 * type:   => New feature
 * severity:   => Normal


-- 
Ticket URL: 
Django 
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.



Re: [Django] #14831: Django Template Style Guide

2010-12-26 Thread Django
#14831: Django Template Style Guide
+---
  Reporter:  DrMeers| Owner:  nobody 
Status:  new| Milestone: 
 Component:  Documentation  |   Version:  1.2
Resolution: |  Keywords:  template, style, format
 Stage:  Accepted   | Has_patch:  0  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Comment (by ramen):

 I would like to see such a standards guide as well, especially regarding
 indentation. In addition to whether all code inside a block should be
 indented, there seems to be a variety of approaches to indentation around
 other template tags such as conditionals and loops. My preference would be
 to indent inside of all template tags that span multiple lines.

-- 
Ticket URL: 
Django 
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-upda...@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.



Re: [Django] #14831: Django Template Style Guide

2010-12-04 Thread Django
#14831: Django Template Style Guide
+---
  Reporter:  DrMeers| Owner:  nobody 
Status:  new| Milestone: 
 Component:  Documentation  |   Version:  1.2
Resolution: |  Keywords:  template, style, format
 Stage:  Accepted   | Has_patch:  0  
Needs_docs:  0  |   Needs_tests:  0  
Needs_better_patch:  0  |  
+---
Changes (by gabrielhurley):

  * needs_better_patch:  => 0
  * stage:  Unreviewed => Accepted
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 I'm in favor of standards in general. What will probably bring this issue
 to a consensus most quickly would be the following:

   1. An overview of the various styles found in the current templates,
   2. A draft patch based on whatever the most common/best practice seems
 to be,
   3. A thread on Django Developers to let folks debate the options.

 A few points that should be specified in a style guide for templates:

   * Indentation: how many spaces?
   * Placement of `extends` and `load` tags (at the top seems pretty
 standard).
   * Whether HTML inside a `block` should always be on its own line or if
 short blocks should be kept on one line. See
 
[http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/admin/base_site.html
 the admin base_site template] for examples of both.
   * Whether all code inside a `block` should be indented. (commonly the
 answer seems to be "no")

 There are probably others, but this is what springs to mind so far.

 Just to toss my two cents into the ring (how's that for a mixed
 metaphor?), here's what I think:

 Even though there's no guiding document like PEP 8 for HTML, I think
 applying as much of PEP 8 as makes sense is going to be the simplest
 answer. It's an established and understood document that Python developers
 are accustomed to. A couple of items that would tend to apply:

   * Where whitespace will not affect rendered output, break up nested tags
 onto their own lines to keep from running over 80 characters.

   * Separate blocks (or other discrete groups of tags or logical sections)
 by blank lines.

   * Imports (i.e. `load` and `extends`) should be at the top of the file,
 on separate lines.

   * Proper whitespace within HTML tags. (``
 not ``)

 I think overall readability and proper indentation of each individual
 template file is more important than what the HTML output looks like. I
 wrap my base templates with the `spaceless` tag though, so it matters less
 to me.

 Use 4 spaces for indentation. (I know 2 spaces is popular for HTML among
 many developers, but PEP 8 recommends 4 and changing to 2 for templates
 doesn't offer any substantive improvement while it decreases the visual
 separation).

-- 
Ticket URL: 
Django 
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-upda...@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.



[Django] #14831: Django Template Style Guide

2010-12-03 Thread Django
#14831: Django Template Style Guide
-+--
 Reporter:  DrMeers  |   Owner:  nobody
   Status:  new  |   Milestone:
Component:  Documentation| Version:  1.2   
 Keywords:  template, style, format  |   Stage:  Unreviewed
Has_patch:  0|  
-+--
 It would be nice to have a standard template style that should be
 followed. For example, I like to indent my Django templates by two
 additional spaces every time I enter a new HTML or template block. The
 Django core templates vary greatly in regards to style and indentation.
 Much of the time template readability is sacrificed in favour of
 attempting to preserve the "appearance" of the generated HTML code.

 Regardless of what is decided, it would be great to have at least some
 guidelines for templates added to
 http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style

-- 
Ticket URL: 
Django 
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-upda...@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.