#9881 closed (fixed)
Auth login should pass current_site to template, not current_site.name
| Reported by: | walterk | Owned by: | Natalia Bidart |
|---|---|---|---|
| Component: | contrib.auth | Version: | 1.0 |
| Severity: | Keywords: | pycamp2009 | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | UI/UX: |
Description
Currently, django.contrib.auth's login method passes 'current_site.name' to the template:
return render_to_response(template_name, {
'form': form,
redirect_field_name: redirect_to,
'site_name': current_site.name,
}, context_instance=RequestContext(request))
login = never_cache(login)
It would be preferable if the dictionary pair were 'site': current_site instead. (This is how django-registration works.) In my current project, 'site_name' overrides a variable defined in a custom context processor, which serves the same function. We prefer to not use contrib.sites to pass the site name and domain to templates, since this requires slightly more set up and maintenance. (E.g., making sure 'example.com' gets replaced whenever the database gets wiped.)
Passing 'site': current_site instead of 'site_name': current_site.name would make contrib.auth behavior more consistent with the django-registration module as well.
Attachments (1)
Change History (9)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
| Version: | SVN → 1.0 |
|---|
comment:3 by , 17 years ago
comment:4 by , 17 years ago
| milestone: | → 1.1 |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
Agreed; there's no reason not to pass the site in there.
comment:5 by , 17 years ago
| Keywords: | pycamp2009 added |
|---|---|
| Owner: | changed from to |
| Status: | new → assigned |
by , 17 years ago
| Attachment: | patch-9881.diff added |
|---|
comment:6 by , 17 years ago
| Has patch: | set |
|---|
comment:7 by , 17 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
You can't remove the current values that are passed through, since that would break every single template that is using the existing code. There is an argument for passing in the extra object, however.