Django

Code

Ticket #2966 (closed: fixed)

Opened 3 years ago

Last modified 3 years ago

[PATCH] add extra_context parameter to django.views.generic.direct_to_template

Reported by: wam-djangobug@wamber.net Assigned to: jacob
Milestone: Component: Generic views
Version: SVN Keywords: extra_context
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

There is currently no way to pass directly "top-level" context variables to the direct_to_template() generic view. Additional parameters sent via keyword arguments to the view are currently passed into the context accessible via the 'params' dictionary. If a base template for an application requires a particular context variable though, there is no way to get that variable defined with direct_to_template as it is now. The attached patch adds extra_context, which adds the specified dictionary values into context of the template directly, without having to indirect through 'params'. It is backwards compatible with the current direct_to_template invocation as well, as any keyword arguments other than 'extra_context' will still end up in the 'params' dictionary. This patch makes direct_to_template() behave more like the other generic views.

Attachments

direct_to_template-extra_context.patch (0.8 kB) - added by wam-djangobug@wamber.net on 10/28/06 19:03:08.
patch to add extra_context param to direct_to_template() generic view

Change History

10/28/06 19:03:08 changed by wam-djangobug@wamber.net

  • attachment direct_to_template-extra_context.patch added.

patch to add extra_context param to direct_to_template() generic view

10/30/06 08:30:44 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

(In [3950]) Fixes #2966 -- Added extra_context parameter to direct_to_template generic view to keep it aligned with capabilities of other generic views. Thanks, wam-djangobug@wamber.net.

10/30/06 14:57:35 changed by adrian

(In [3953]) Added note to docs/generic_views.txt that extra_context is new in Django development version. Refs #2966 and [3950]


Add/Change #2966 ([PATCH] add extra_context parameter to django.views.generic.direct_to_template)




Change Properties
Action