#5298 closed (fixed)
The extra_context keyword argument should be available in the auth app views
Reported by: | 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)
Change History (25)
comment:1 by , 17 years ago
Component: | Uncategorized → Metasystem |
---|---|
Owner: | changed from | to
Triage Stage: | Unreviewed → Design decision needed |
Version: | 0.96 → SVN |
comment:2 by , 17 years ago
Component: | Metasystem → Contrib apps |
---|---|
Triage Stage: | Design decision needed → Accepted |
Seems like a reasonable idea.
comment:3 by , 17 years ago
Owner: | changed from | to
---|
by , 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 , 17 years ago
Has patch: | set |
---|
by , 17 years ago
Attachment: | patch_5298.diff added |
---|
by , 17 years ago
Attachment: | patch_5298.2.diff added |
---|
comment:6 by , 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 , 17 years ago
Keywords: | sprintsept14 added |
---|
comment:8 by , 17 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:9 by , 17 years ago
Triage Stage: | Ready for checkin → Accepted |
---|
Mostly fine - but why the 'update_context_from_dict' method? Why not just use Context.update()?
comment:10 by , 17 years ago
Cc: | 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
comment:11 by , 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 , 15 years ago
Version: | SVN → 1.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 , 15 years ago
The patch should use None
, not {}
as default value, due to potential 'mutable defaults' issue.
follow-up: 15 comment:14 by , 15 years ago
Version: | 1.1 → SVN |
---|
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 , 15 years ago
Attachment: | contrib_auth_views_extra_context.patch added |
---|
Patch for extra_context, current as of changeset [13042]
comment:16 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Want to write a patch?