Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#12816 closed (fixed)

Add a render() shortcut

Reported by: Russell Keith-Magee Owned by: Ivan Sagalaev
Component: Core (Other) Version:
Severity: Keywords:
Cc: Alexander Koshelev, Mikhail Korobov Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

render_to_response(template, view, context_instance=RequestContext(request)) is such a common idiom that it deserves a shortcut of it's own.

Related: #12815 If we're going to introduce a new TemplateResponse, it might be appropriate for a new render() shortcut to return that class.

Attachments (7)

render_shortcut.diff (12.4 KB) - added by Mikhail Korobov 6 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.2.diff (12.6 KB) - added by Mikhail Korobov 6 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.3.diff (14.7 KB) - added by Mikhail Korobov 6 years ago.
more tests and changed _set_content behaviour
render_shortcut.4.diff (14.8 KB) - added by Mikhail Korobov 6 years ago.
More tests fixes. Sorry for patch spam.
render_shortcut.5.diff (22.0 KB) - added by Mikhail Korobov 6 years ago.
generic views integration, fixed test client and messages middleware
render_shortcut.6.diff (77.3 KB) - added by Mikhail Korobov 6 years ago.
force_bake is removed, template response middleware is introduces, exception is raised on content access for unbaked responses, more tests and some docs
t12815-rc1.diff (81.2 KB) - added by Russell Keith-Magee 6 years ago.
RC1 for TemplateResponse and render() shortcut

Download all attachments as: .zip

Change History (17)

comment:1 Changed 7 years ago by Russell Keith-Magee

Component: UncategorizedCore framework
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted

Jacob, Simon, and others are on the record as being in favor. The only hesitation is the relationship with #12815; we should resolve that decision before committing anything for this ticket.

comment:2 Changed 6 years ago by Alexander Koshelev

Cc: Alexander Koshelev added
Owner: changed from nobody to Alexander Koshelev
Status: newassigned

comment:3 Changed 6 years ago by Alexander Koshelev

Owner: Alexander Koshelev deleted
Status: assignednew

comment:4 Changed 6 years ago by Mikhail Korobov

Cc: Mikhail Korobov added
milestone: 1.3
Needs documentation: set
Needs tests: set
Owner: set to Mikhail Korobov

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.diff added

django.shortcuts.render implemented as TemplateResponse, with tests but without docs

comment:5 Changed 6 years ago by Mikhail Korobov

Has patch: set
Needs tests: unset

trac doesn't want to show diff properly.
Here is the alternative: http://bitbucket.org/kmike/django/changeset/5c98028837aa

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.2.diff added

django.shortcuts.render implemented as TemplateResponse, with tests but without docs

comment:6 Changed 6 years ago by Mikhail Korobov

The first diff has broken test. Here is the correct one: http://bitbucket.org/kmike/django/changeset/37d977574923

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.3.diff added

more tests and changed _set_content behaviour

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.4.diff added

More tests fixes. Sorry for patch spam.

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.5.diff added

generic views integration, fixed test client and messages middleware

Changed 6 years ago by Mikhail Korobov

Attachment: render_shortcut.6.diff added

force_bake is removed, template response middleware is introduces, exception is raised on content access for unbaked responses, more tests and some docs

comment:7 Changed 6 years ago by Mikhail Korobov

Owner: Mikhail Korobov deleted

comment:8 Changed 6 years ago by Ivan Sagalaev

Owner: set to Ivan Sagalaev

Changed 6 years ago by Russell Keith-Magee

Attachment: t12815-rc1.diff added

RC1 for TemplateResponse and render() shortcut

comment:9 Changed 6 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [15008]) Fixed #12816 -- Added a render() shortcut.

comment:10 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

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