Code

Opened 7 years ago

Closed 7 years ago

#4756 closed (wontfix)

Mention direct_to_template as an alternate shortcut when wanting RequestContext

Reported by: SmileyChris Owned by: nobody
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Currently the docs suggest passing a RequestContext instance to the render_to_response() shortcut. But that means also importing RequestContext which makes it a bit less "short" and the actual "cut" less concise.

Perhaps we could mention using the simple generic view direct_to_template() as an alternate shortcut?

Attachments (1)

4756.patch (1.4 KB) - added by SmileyChris 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by SmileyChris

comment:1 Changed 7 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 7 years ago by ubernostrum

I'd be inclined not to do this because they're really not the same thing; if you just want to render a template, use direct_to_template. But if you want to do more, writing a wrapper view which looks stuff up and calls direct_to_template with a dictionary of variables is probably more work than just writing a view which uses RequestContext to do the same thing.

comment:3 Changed 7 years ago by ubernostrum

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

And on further reflection, I'm going to stand by the above comment and mark this "wontfix"; direct_to_template really isn't appropriate for a case where you just want to get a RequestContext in your view (since in either case you have to import something and change the way your view function returns).

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.