Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#12816 closed (fixed)

Add a render() shortcut

Reported by: russellm Owned by: isagalaev
Component: Core (Other) Version:
Severity: Keywords:
Cc: alexkoshelev, kmike 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 kmike 5 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.2.diff (12.6 KB) - added by kmike 5 years ago.
django.shortcuts.render implemented as TemplateResponse, with tests but without docs
render_shortcut.3.diff (14.7 KB) - added by kmike 5 years ago.
more tests and changed _set_content behaviour
render_shortcut.4.diff (14.8 KB) - added by kmike 5 years ago.
More tests fixes. Sorry for patch spam.
render_shortcut.5.diff (22.0 KB) - added by kmike 5 years ago.
generic views integration, fixed test client and messages middleware
render_shortcut.6.diff (77.3 KB) - added by kmike 5 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 russellm 5 years ago.
RC1 for TemplateResponse and render() shortcut

Download all attachments as: .zip

Change History (17)

comment:1 Changed 6 years ago by russellm

  • Component changed from Uncategorized to Core framework
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 5 years ago by alexkoshelev

  • Cc alexkoshelev added
  • Owner changed from nobody to alexkoshelev
  • Status changed from new to assigned

comment:3 Changed 5 years ago by alexkoshelev

  • Owner alexkoshelev deleted
  • Status changed from assigned to new

comment:4 Changed 5 years ago by kmike

  • Cc kmike added
  • milestone set to 1.3
  • Needs documentation set
  • Needs tests set
  • Owner set to kmike

Changed 5 years ago by kmike

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

comment:5 Changed 5 years ago by kmike

  • 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 5 years ago by kmike

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

comment:6 Changed 5 years ago by kmike

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

Changed 5 years ago by kmike

more tests and changed _set_content behaviour

Changed 5 years ago by kmike

More tests fixes. Sorry for patch spam.

Changed 5 years ago by kmike

generic views integration, fixed test client and messages middleware

Changed 5 years ago by kmike

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 5 years ago by kmike

  • Owner kmike deleted

comment:8 Changed 5 years ago by isagalaev

  • Owner set to isagalaev

Changed 5 years ago by russellm

RC1 for TemplateResponse and render() shortcut

comment:9 Changed 5 years ago by russellm

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

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

comment:10 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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