Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#25732 closed Cleanup/optimization (fixed)

Update "Don’t invent a programming language" section Design Philosophies doc

Reported by: Neal Todd Owned by: Neal Todd
Component: Documentation Version: dev
Severity: Normal Keywords:
Cc: neal@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

The "Don’t invent a programming language" section in Design philosophies states:

The template system intentionally doesn’t allow ... Assignment to variables

However, the 1.9 release adds support for this via the simple_tag:

Template tags created with the simple_tag() helper can now store results in a template variable by using the as argument.

The docs need to be made consistent, at least by removing that specific statement. I haven't included a PR on this as it may be the case that a more through rewrite of this section is due. It also states that "Advanced logic" isn't allowed either. With the various additional features in Templates in the last few versions, including jinja2 support that might be stretching the assertion a bit far now. True, it's not advanced compared to what can be done in Python, but the logic control is quite sophisticated.

Maybe just removing the first line and the two bullet points is enough? If so, I can submit a PR.

NB: this is referenced here:

https://code.djangoproject.com/ticket/6378#comment:24

(an old open ticket that looks like it can be closed as a result of the single_tag update).

Change History (4)

comment:1 by Tim Graham, 9 years ago

Triage Stage: UnreviewedAccepted

I guess we could make a distinction between "Template system" and the "Django Template Language (DTL)" which I think still mostly aims to avoid "Advanced logic". Feel free to submit a PR.

comment:2 by Neal Todd, 9 years ago

Cc: neal@… added
Has patch: set
Owner: changed from nobody to Neal Todd
Status: newassigned

comment:3 by Tim Graham <timograham@…>, 9 years ago

Resolution: fixed
Status: assignedclosed

In 7436558:

Fixed #25732 -- Updated template system design philosophy.

Removed the bit about not allowing assignment to variables
because simple_tag now allows this.

comment:4 by Tim Graham <timograham@…>, 9 years ago

In 15cf906:

[1.9.x] Fixed #25732 -- Updated template system design philosophy.

Removed the bit about not allowing assignment to variables
because simple_tag now allows this.

Backport of 74365585e28174834184e659b788c917303cd98a from master

Note: See TracTickets for help on using tickets.
Back to Top