Opened 21 months ago

Closed 21 months ago

Last modified 21 months 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: master
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 Changed 21 months ago by timo

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 21 months ago by Tim Graham <timograham@…>

  • Resolution set to fixed
  • Status changed from new to closed

In f685f94c9867461a7838a56b2c2adbec984eee7e:

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

comment:3 Changed 21 months ago by Tim Graham <timograham@…>

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