Removed admin_util test dependency on contrib.sites

This commit is contained in:
Claude Paroz 2014-12-23 18:43:55 +01:00
parent f05b03f3d7
commit 90720d549a
2 changed files with 10 additions and 3 deletions

View File

@ -3,11 +3,19 @@ from django.utils import six
from django.utils.encoding import python_2_unicode_compatible from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Site(models.Model):
domain = models.CharField(max_length=100)
def __str__(self):
return self.domain
class Article(models.Model): class Article(models.Model):
""" """
A simple Article model for testing A simple Article model for testing
""" """
site = models.ForeignKey('sites.Site', related_name="admin_articles") site = models.ForeignKey(Site, related_name="admin_articles")
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
title2 = models.CharField(max_length=100, verbose_name="another name") title2 = models.CharField(max_length=100, verbose_name="another name")
created = models.DateTimeField() created = models.DateTimeField()

View File

@ -8,7 +8,6 @@ from django.contrib.admin import helpers
from django.contrib.admin.utils import (display_for_field, flatten, from django.contrib.admin.utils import (display_for_field, flatten,
flatten_fieldsets, label_for_field, lookup_field, NestedObjects) flatten_fieldsets, label_for_field, lookup_field, NestedObjects)
from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE from django.contrib.admin.views.main import EMPTY_CHANGELIST_VALUE
from django.contrib.sites.models import Site
from django.db import models, DEFAULT_DB_ALIAS from django.db import models, DEFAULT_DB_ALIAS
from django import forms from django import forms
from django.test import TestCase from django.test import TestCase
@ -16,7 +15,7 @@ from django.utils.formats import localize
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils import six from django.utils import six
from .models import Article, Count, Event, Location, EventGuide, Vehicle, Car from .models import Site, Article, Count, Event, Location, EventGuide, Vehicle, Car
class NestedObjectsTests(TestCase): class NestedObjectsTests(TestCase):