Opened 8 years ago

Closed 7 years ago

Last modified 5 years ago

#9881 closed (fixed)

Auth login should pass current_site to template, not

Reported by: walterk Owned by: nessita
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:


Currently, django.contrib.auth's login method passes '' to the template:

    return render_to_response(template_name, {
        'form': form,
        redirect_field_name: redirect_to,
    }, 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 '' gets replaced whenever the database gets wiped.)

Passing 'site': current_site instead of 'site_name': would make contrib.auth behavior more consistent with the django-registration module as well.

Attachments (1)

patch-9881.diff (3.7 KB) - added by nessita 7 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 8 years ago by walterk

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by anonymous

  • Version changed from SVN to 1.0

comment:3 Changed 8 years ago by mtredinnick

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.

comment:4 Changed 7 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

Agreed; there's no reason not to pass the site in there.

comment:5 Changed 7 years ago by nessita

  • Keywords pycamp2009 added
  • Owner changed from nobody to nessita
  • Status changed from new to assigned

Changed 7 years ago by nessita

comment:6 Changed 7 years ago by nessita

  • Has patch set

comment:7 Changed 7 years ago by jacob

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10330]) Fixed #9881: Added the to the login view context, not just the site's name. Thanks, nessita.

comment:8 Changed 5 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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