mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Suppressed the if Site._meta.installed pattern.
The purpose of this construct is to test if the django.contrib.sites application is installed. But in Django 1.9 it will be forbidden to import the Site model when the django.contrib.sites application isn't installed. No model besides Site used this pattern. Refs #21719, #21923.
This commit is contained in:
@@ -3,8 +3,8 @@ import itertools
|
||||
import os
|
||||
import re
|
||||
|
||||
from django.apps import apps
|
||||
from django.conf import global_settings, settings
|
||||
from django.contrib.sites.models import Site
|
||||
from django.contrib.sites.requests import RequestSite
|
||||
from django.contrib.admin.models import LogEntry
|
||||
from django.contrib.auth.models import User
|
||||
@@ -446,7 +446,8 @@ class LoginTest(AuthViewsTestCase):
|
||||
def test_current_site_in_context_after_login(self):
|
||||
response = self.client.get(reverse('login'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
if Site._meta.installed:
|
||||
if apps.is_installed('django.contrib.sites'):
|
||||
Site = apps.get_model('sites.Site')
|
||||
site = Site.objects.get_current()
|
||||
self.assertEqual(response.context['site'], site)
|
||||
self.assertEqual(response.context['site_name'], site.name)
|
||||
|
||||
Reference in New Issue
Block a user