Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#21580 closed Cleanup/optimization (fixed)

Unclear why shortcut function "render" can not return TemplateResponse object

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

Description

The reason is - apparently - that this is pointless as TemplateResponse has a constructor with a syntax equivalently convenient as render().

See https://groups.google.com/forum/#!searchin/django-developers/templateresponse/django-developers/mOx9ddVTrPA/-WbaVc0pqeYJ.

I have created a pull request and I suggest to update the documentation accordingly. I was confused by the fact that TemplateResponse is not even mentioned in the shortcut section, although using it should be a rather common thing. It gives the impression that TemplateResponse is a "2nd class citizen".

Here's a link to the pull request: https://github.com/django/django/pull/2053

Change History (3)

comment:1 by Tim Graham, 11 years ago

Patch needs improvement: set
Triage Stage: UnreviewedAccepted

comment:2 by Tim Graham <timograham@…>, 11 years ago

Resolution: fixed
Status: newclosed

In f685f94c9867461a7838a56b2c2adbec984eee7e:

Fixed #21580 -- Clarified why render() does not return a TemplateResponse object.

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

In eb4079597dba8bca94b97afab71dd955ccf4c3fe:

[1.6.x] Fixed #21580 -- Clarified why render() does not return a TemplateResponse object.

Backport of f685f94c98 from master

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