Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5163 closed (worksforme)

django.contrib.auth.views.login depends on sites framework

Reported by: olau@… Owned by: Adrian Holovaty
Component: Contrib apps Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The handy login view appears to be depending on the sites framework for the sole reason of providing the site name in the context given to the template. Would it be possible to add the site name only if the sites framework is installed, turning the framework into a soft dependency?

I run a single site so I don't need the sites framework. It just confuses my users when it turns up in the admin.

Change History (4)

comment:1 Changed 11 years ago by Malcolm Tredinnick

There's a bunch of stuff that depends on the sites framework like this and having the correct domain name available is important in some of these places. So we would need a way to have access to the correct domain name even if sites wasn't available.

This is possible in any number of ways, but anybody wanting to write a patch for this should ensure it works with aliased DNS names, Apache virtual hosts, as well as standard single-home, single named servers. It should also work seamlessly, in that existing code shouldn't break, ideally.

comment:2 Changed 11 years ago by Malcolm Tredinnick

Triage Stage: UnreviewedAccepted

(Moving to "Accepted", since being able to operate with a reduced sites framework setup isn't a bad goal. But somebody is going to have to do some real design work here. Probably worth sending initial design discussions to django-dev once you have made a first pass at it.)

comment:3 Changed 11 years ago by Chris Beaven

Resolution: worksforme
Status: newclosed

My patch in #987 would fix getting the current domain name without needing sites.

Apart from that, the login view *doesn't* have a hard dependency:

    if Site._meta.installed:
        current_site = Site.objects.get_current()
        current_site = RequestSite(request) will just equal request.META['SERVER_NAME'] if sites isn't installed.

comment:4 Changed 11 years ago by olau@…

Great! Sorry for the confusion, the code has obviously been changed since my checkout.

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