Ticket #4225: contrib.auth.views.login.patch
File contrib.auth.views.login.patch, 1.1 KB (added by , 18 years ago) |
---|
-
contrib/auth/views.py
8 8 from django.contrib.auth.decorators import login_required 9 9 from django.contrib.auth import REDIRECT_FIELD_NAME 10 10 11 class GenericSite(object): 12 domain = 'example.com' 13 name = 'my site' 14 11 15 def login(request, template_name='registration/login.html'): 12 16 "Displays the login form and handles the login action." 13 17 manipulator = AuthenticationForm(request) … … 26 30 else: 27 31 errors = {} 28 32 request.session.set_test_cookie() 33 if Site._meta.installed: 34 site_obj = Site.objects.get_current().name 35 else: 36 site_obj = GenericSite() 29 37 return render_to_response(template_name, { 30 38 'form': oldforms.FormWrapper(manipulator, request.POST, errors), 31 39 REDIRECT_FIELD_NAME: redirect_to, 32 'site_name': Site.objects.get_current().name,40 'site_name': site_obj, 33 41 }, context_instance=RequestContext(request)) 34 42 35 43 def logout(request, next_page=None, template_name='registration/logged_out.html'):