Opened 15 years ago

Closed 14 years ago

Last modified 13 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: no UI/UX: no

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 14 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.2.diff (12.6 KB ) - added by Mikhail Korobov 14 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.3.diff (14.7 KB ) - added by Mikhail Korobov 14 years ago.
more tests and changed _set_content behaviour
render_shortcut.4.diff (14.8 KB ) - added by Mikhail Korobov 14 years ago.
More tests fixes. Sorry for patch spam.
render_shortcut.5.diff (22.0 KB ) - added by Mikhail Korobov 14 years ago.
generic views integration, fixed test client and messages middleware
render_shortcut.6.diff (77.3 KB ) - added by Mikhail Korobov 14 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 14 years ago.
RC1 for TemplateResponse and render() shortcut

Download all attachments as: .zip

Change History (17)

comment:1 by Russell Keith-Magee, 15 years ago

Component: UncategorizedCore framework
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 by Alexander Koshelev, 14 years ago

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

comment:3 by Alexander Koshelev, 14 years ago

Owner: Alexander Koshelev removed
Status: assignednew

comment:4 by Mikhail Korobov, 14 years ago

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

by Mikhail Korobov, 14 years ago

Attachment: render_shortcut.diff added

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

comment:5 by Mikhail Korobov, 14 years ago

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

by Mikhail Korobov, 14 years ago

Attachment: render_shortcut.2.diff added

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

comment:6 by Mikhail Korobov, 14 years ago

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

by Mikhail Korobov, 14 years ago

Attachment: render_shortcut.3.diff added

more tests and changed _set_content behaviour

by Mikhail Korobov, 14 years ago

Attachment: render_shortcut.4.diff added

More tests fixes. Sorry for patch spam.

by Mikhail Korobov, 14 years ago

Attachment: render_shortcut.5.diff added

generic views integration, fixed test client and messages middleware

by Mikhail Korobov, 14 years ago

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 by Mikhail Korobov, 14 years ago

Owner: Mikhail Korobov removed

comment:8 by Ivan Sagalaev, 14 years ago

Owner: set to Ivan Sagalaev

by Russell Keith-Magee, 14 years ago

Attachment: t12815-rc1.diff added

RC1 for TemplateResponse and render() shortcut

comment:9 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

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

comment:10 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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