diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2007-08-14 22:08:11 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2007-08-14 22:08:11 +0000 |
| commit | 6aae9b2aa413b16e77e864ac69aa616aa7e2d969 (patch) | |
| tree | 65c9eb2be8355457b60ab311d1a6da5ea1c59a0e /django/contrib/auth/views.py | |
| parent | 9b99a60cfa6a431a44cfb87c6b6417b3e1578511 (diff) | |
Changed django.contrib.auth.views.login to use RequestSite if the sites framework is not installed -- i.e., the sites framework is no longer required to use this view. See also [5654]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/auth/views.py')
| -rw-r--r-- | django/contrib/auth/views.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py index 141f710bfd..a0dc59c718 100644 --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -3,7 +3,7 @@ from django.contrib.auth.forms import PasswordResetForm, PasswordChangeForm from django import oldforms from django.shortcuts import render_to_response from django.template import RequestContext -from django.contrib.sites.models import Site +from django.contrib.sites.models import Site, RequestSite from django.http import HttpResponseRedirect from django.contrib.auth.decorators import login_required from django.contrib.auth import REDIRECT_FIELD_NAME @@ -27,10 +27,16 @@ def login(request, template_name='registration/login.html'): else: errors = {} request.session.set_test_cookie() + + if Site._meta.installed: + current_site = Site.objects.get_current() + else: + current_site = RequestSite(self.request) + return render_to_response(template_name, { 'form': oldforms.FormWrapper(manipulator, request.POST, errors), REDIRECT_FIELD_NAME: redirect_to, - 'site_name': Site.objects.get_current().name, + 'site_name': current_site.name, }, context_instance=RequestContext(request)) def logout(request, next_page=None, template_name='registration/logged_out.html'): |
