Django

Code

Changeset 5885

Show
Ignore:
Timestamp:
08/14/07 17:08:11 (1 year ago)
Author:
adrian
Message:

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]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/auth/views.py

    r5609 r5885  
    44from django.shortcuts import render_to_response 
    55from django.template import RequestContext 
    6 from django.contrib.sites.models import Site 
     6from django.contrib.sites.models import Site, RequestSite 
    77from django.http import HttpResponseRedirect 
    88from django.contrib.auth.decorators import login_required 
     
    2828        errors = {} 
    2929    request.session.set_test_cookie() 
     30 
     31    if Site._meta.installed: 
     32        current_site = Site.objects.get_current() 
     33    else: 
     34        current_site = RequestSite(self.request) 
     35 
    3036    return render_to_response(template_name, { 
    3137        'form': oldforms.FormWrapper(manipulator, request.POST, errors), 
    3238        REDIRECT_FIELD_NAME: redirect_to, 
    33         'site_name': Site.objects.get_current().name, 
     39        'site_name': current_site.name, 
    3440    }, context_instance=RequestContext(request)) 
    3541 
  • django/trunk/docs/authentication.txt

    r5850 r5885  
    437437      a query string, too. 
    438438    * ``site_name``: The name of the current ``Site``, according to the 
    439       ``SITE_ID`` setting. See the `site framework docs`_. 
     439      ``SITE_ID`` setting. If you're using the Django development version and 
     440      you don't have the site framework installed, this will be set to the 
     441      value of ``request.META['SERVER_NAME']``. For more on sites, see the 
     442      `site framework docs`_. 
    440443 
    441444If you'd prefer not to call the template ``registration/login.html``, you can