Opened 17 years ago

Closed 14 years ago

Last modified 11 years ago

#5298 closed (fixed)

The extra_context keyword argument should be available in the auth app views

Reported by: peadalo@… Owned by: durdinator
Component: Contrib apps Version: dev
Severity: Keywords: extra_context auth "generic views" sprintsept14
Cc: adurdin@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Enhancement Request

When using the views in the auth app (django.contrib.auth.views), it would be nice to have the option of passing extra context variables through the views and to the templates. This seems to be possible with django generic views by passing a dictionary to the "extra_context" keyword argument.

This would be useful for passing context variables to the login/logout templates which are specific to only those templates and therefore don't belong in the RequestContext context processors.

Attachments (6)

fix-extra_context.diff (3.9 KB ) - added by jordanl 17 years ago.
Adds support for passing extra_context to the views in django.contrib.auth.views
patch_5298.diff (5.1 KB ) - added by durdinator 17 years ago.
patch_5298.2.diff (5.1 KB ) - added by durdinator 17 years ago.
django.contrib.auth.views.patch (4.5 KB ) - added by Jj <jjdelc@…> 17 years ago.
extra_context added to views
contrib_auth_views_extra_context.patch (5.9 KB ) - added by efloehr 15 years ago.
Patch for extra_context, current as of changeset [13042]
auth-extra-content-14586.diff (6.4 KB ) - added by Adam Vandenberg 14 years ago.
Patch updated to r14586

Download all attachments as: .zip

Change History (25)

comment:1 by Simon G. <dev@…>, 17 years ago

Component: UncategorizedMetasystem
Owner: changed from Jacob to Adrian Holovaty
Triage Stage: UnreviewedDesign decision needed
Version: 0.96SVN

Want to write a patch?

comment:2 by Russell Keith-Magee, 17 years ago

Component: MetasystemContrib apps
Triage Stage: Design decision neededAccepted

Seems like a reasonable idea.

comment:3 by durdinator, 17 years ago

Owner: changed from nobody to durdinator

by jordanl, 17 years ago

Attachment: fix-extra_context.diff added

Adds support for passing extra_context to the views in django.contrib.auth.views

comment:4 by jordanl, 17 years ago

Has patch: set

comment:5 by jordanl, 17 years ago

The patch is pretty trivial. Not sure if this even needs tests.

by durdinator, 17 years ago

Attachment: patch_5298.diff added

by durdinator, 17 years ago

Attachment: patch_5298.2.diff added

comment:6 by durdinator, 17 years ago

patch_5298.diff has the same semantics for extra_context as the generic views: i.e. it calls callables in the dict.

patch_5298.2.diff adds a paragraph to the docs about it.

comment:7 by gkelly, 17 years ago

Keywords: sprintsept14 added

comment:8 by Simon G. <dev@…>, 17 years ago

Triage Stage: AcceptedReady for checkin

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

Triage Stage: Ready for checkinAccepted

Mostly fine - but why the 'update_context_from_dict' method? Why not just use Context.update()?

comment:10 by durdinator, 17 years ago

Cc: adurdin@… added

I was following the example of the extra_context argument to generic views, whereby callables are called -- for comparison see http://code.djangoproject.com/browser/django/trunk/django/views/generic/list_detail.py#L88

by Jj <jjdelc@…>, 17 years ago

extra_context added to views

comment:11 by Jj <jjdelc@…>, 17 years ago

I just added the django.contrib.auth.views.patch patch that adds extra_context support to the auth views, It has minimal impact in the overall code and should not affect current code.

comment:12 by CrashRoX, 15 years ago

Version: SVN1.1

This is still not as of 1.1...
(r'login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html', 'extra_context': {'test': 'test'}})

comment:13 by Luke Plant, 15 years ago

The patch should use None, not {} as default value, due to potential 'mutable defaults' issue.

comment:14 by efloehr, 15 years ago

Version: 1.1SVN

This patch no longer works with trunk, due to changes in auth. I've attached an updated patch, current as of [12938]. I've also changed the patch to default extra_context to None instead of the original {}, as suggested by lukeplant in previous comment. I've also changed version to SVN as this patch isn't in 1.1.

by efloehr, 15 years ago

Patch for extra_context, current as of changeset [13042]

in reply to:  14 comment:15 by efloehr, 15 years ago

Replying to efloehr:
Patch current as of [13042].

by Adam Vandenberg, 14 years ago

Patch updated to r14586

comment:16 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: newclosed

(In [14768]) Fixed #5298 -- Added extra_context to contrib auth views.

comment:17 by Tim Graham <timograham@…>, 11 years ago

In 61ecb5f48a4732f1471f858c64904ec1c4763925:

Fixed #20855 -- Added documentation of current_app and extra_context params to django.contrib.auth views

refs #5298 and refs #8342

comment:18 by Tim Graham <timograham@…>, 11 years ago

In 77293f9354774e2631087935f1550c674093c433:

[1.6.x] Fixed #20855 -- Added documentation of current_app and extra_context params to django.contrib.auth views

refs #5298 and refs #8342

Backport of 61ecb5f48a from master

comment:19 by Tim Graham <timograham@…>, 11 years ago

In 145e0a14f0c098d7bbf2bfb593f7b6cfe1b02d72:

[1.5.x] Fixed #20855 -- Added documentation of current_app and extra_context params to django.contrib.auth views

refs #5298 and refs #8342

Backport of 61ecb5f48a from master.

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