Convert the remainder of the relative imports in the tests to be absolute imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16981 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-10-13 21:34:56 +00:00
parent f830166167
commit 8c0eefd066
144 changed files with 580 additions and 265 deletions

View File

@ -1,9 +1,12 @@
from __future__ import absolute_import
from django.contrib import admin from django.contrib import admin
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
from models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact, from .models import (Media, PhoneNumber, Episode, EpisodeExtra, Contact,
Category, EpisodePermanent, EpisodeMaxNum) Category, EpisodePermanent, EpisodeMaxNum)
site = admin.AdminSite(name="admin") site = admin.AdminSite(name="admin")
class MediaInline(generic.GenericTabularInline): class MediaInline(generic.GenericTabularInline):

View File

@ -1,6 +1,6 @@
from django.db import models
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import models
class Episode(models.Model): class Episode(models.Model):

View File

@ -1,5 +1,7 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib import admin from django.contrib import admin
from django.contrib.admin.sites import AdminSite from django.contrib.admin.sites import AdminSite
@ -9,9 +11,9 @@ from django.forms.models import ModelForm
from django.test import TestCase from django.test import TestCase
# local test models # local test models
from models import (Episode, EpisodeExtra, EpisodeMaxNum, Media, from .admin import MediaInline, MediaPermanentInline
from .models import (Episode, EpisodeExtra, EpisodeMaxNum, Media,
EpisodePermanent, Category) EpisodePermanent, Category)
from admin import MediaInline, MediaPermanentInline
class GenericAdminViewTest(TestCase): class GenericAdminViewTest(TestCase):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.conf.urls import patterns, include from django.conf.urls import patterns, include
import admin from . import admin
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^generic_inline_admin/admin/', include(admin.site.urls)), (r'^generic_inline_admin/admin/', include(admin.site.urls)),

View File

@ -1,9 +1,10 @@
from django.db import models
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import models
__all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2', __all__ = ('Link', 'Place', 'Restaurant', 'Person', 'Address',
'CharLink', 'TextLink', 'OddRelation1', 'OddRelation2',
'Contact', 'Organization', 'Note') 'Contact', 'Organization', 'Note')
class Link(models.Model): class Link(models.Model):

View File

@ -1,6 +1,9 @@
from django.test import TestCase
from django.db.models import Q from django.db.models import Q
from models import * from django.test import TestCase
from .models import (Address, Place, Restaurant, Link, CharLink, TextLink,
Person, Contact, Note, Organization, OddRelation1, OddRelation2)
class GenericRelationTests(TestCase): class GenericRelationTests(TestCase):

View File

@ -1,9 +1,9 @@
import time import time
import unittest
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.http import HttpResponse from django.http import HttpResponse
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory
from django.utils import unittest
from django.views.generic import View, TemplateView, RedirectView from django.views.generic import View, TemplateView, RedirectView

View File

@ -1,9 +1,12 @@
from __future__ import absolute_import
import datetime import datetime
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from regressiontests.generic_views.models import Book from .models import Book
class ArchiveIndexViewTests(TestCase): class ArchiveIndexViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from regressiontests.generic_views.models import Artist, Author, Page from .models import Artist, Author, Page
class DetailViewTest(TestCase): class DetailViewTest(TestCase):

View File

@ -1,11 +1,14 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django import forms from django import forms
from django.test import TestCase from django.test import TestCase
from django.utils.unittest import expectedFailure from django.utils.unittest import expectedFailure
from regressiontests.generic_views.models import Artist, Author from . import views
from regressiontests.generic_views import views from .models import Artist, Author
class ModelFormMixinTests(TestCase): class ModelFormMixinTests(TestCase):
def test_get_form(self): def test_get_form(self):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django import forms from django import forms
from regressiontests.generic_views.models import Author from .models import Author
class AuthorForm(forms.ModelForm): class AuthorForm(forms.ModelForm):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from django.test import TestCase from django.test import TestCase
from regressiontests.generic_views.models import Author, Artist from .models import Author, Artist
class ListViewTests(TestCase): class ListViewTests(TestCase):
fixtures = ['generic-views-test-data.json'] fixtures = ['generic-views-test-data.json']

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Artist(models.Model): class Artist(models.Model):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)

View File

@ -1,5 +1,10 @@
from regressiontests.generic_views.base import ViewTest, TemplateViewTest, RedirectViewTest from __future__ import absolute_import
from regressiontests.generic_views.dates import ArchiveIndexViewTests, YearArchiveViewTests, MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests, DateDetailViewTests
from regressiontests.generic_views.detail import DetailViewTest from .base import ViewTest, TemplateViewTest, RedirectViewTest
from regressiontests.generic_views.edit import ModelFormMixinTests, CreateViewTests, UpdateViewTests, DeleteViewTests from .dates import (ArchiveIndexViewTests, YearArchiveViewTests,
from regressiontests.generic_views.list import ListViewTests MonthArchiveViewTests, WeekArchiveViewTests, DayArchiveViewTests,
DateDetailViewTests)
from .detail import DetailViewTest
from .edit import (ModelFormMixinTests, CreateViewTests, UpdateViewTests,
DeleteViewTests)
from .list import ListViewTests

View File

@ -1,8 +1,10 @@
from django.conf.urls import patterns, url from __future__ import absolute_import
from django.views.generic import TemplateView
from django.views.decorators.cache import cache_page
import views from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
from . import views
urlpatterns = patterns('', urlpatterns = patterns('',

View File

@ -1,11 +1,13 @@
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.core.paginator import Paginator from django.core.paginator import Paginator
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.views import generic from django.views import generic
from regressiontests.generic_views.models import Artist, Author, Book, Page from .forms import AuthorForm
from regressiontests.generic_views.forms import AuthorForm from .models import Artist, Author, Book, Page
class CustomTemplateView(generic.TemplateView): class CustomTemplateView(generic.TemplateView):

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from models import Author, Publisher from .models import Author, Publisher
class GetOrCreateTests(TestCase): class GetOrCreateTests(TestCase):

View File

@ -1,7 +1,7 @@
from django.utils import unittest
from django.conf import settings from django.conf import settings
from django.core.handlers.wsgi import WSGIHandler from django.core.handlers.wsgi import WSGIHandler
from django.test import RequestFactory from django.test import RequestFactory
from django.utils import unittest
class HandlerTests(unittest.TestCase): class HandlerTests(unittest.TestCase):

View File

@ -5,6 +5,7 @@ from django.http import (QueryDict, HttpResponse, SimpleCookie, BadHeaderError,
parse_cookie) parse_cookie)
from django.utils import unittest from django.utils import unittest
class QueryDictTests(unittest.TestCase): class QueryDictTests(unittest.TestCase):
def test_missing_key(self): def test_missing_key(self):
q = QueryDict('') q = QueryDict('')

View File

@ -8,8 +8,8 @@ from django.core.management import CommandError
from django.core.management.commands.compilemessages import compile_messages from django.core.management.commands.compilemessages import compile_messages
from django.test import TestCase from django.test import TestCase
LOCALE='es_AR'
LOCALE='es_AR'
class MessageCompilationTests(TestCase): class MessageCompilationTests(TestCase):

View File

@ -2,8 +2,10 @@
import os import os
import re import re
import shutil import shutil
from django.test import TestCase
from django.core import management from django.core import management
from django.test import TestCase
LOCALE='de' LOCALE='de'

View File

@ -3,10 +3,10 @@ from __future__ import with_statement
import os import os
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase from django.test import TestCase
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import translation from django.utils import translation
from django.contrib.contenttypes.models import ContentType
class ContentTypeTests(TestCase): class ContentTypeTests(TestCase):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django import forms from django import forms
from django.forms.extras import SelectDateWidget from django.forms.extras import SelectDateWidget
from models import Company from .models import Company
class I18nForm(forms.Form): class I18nForm(forms.Form):
decimal_field = forms.DecimalField(localize=True) decimal_field = forms.DecimalField(localize=True)

View File

@ -1,7 +1,9 @@
from datetime import datetime from datetime import datetime
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
class TestModel(models.Model): class TestModel(models.Model):
text = models.CharField(max_length=10, default=_('Anything')) text = models.CharField(max_length=10, default=_('Anything'))

View File

@ -1,5 +1,5 @@
from os.path import join, normpath, abspath, dirname
import warnings import warnings
from os.path import join, normpath, abspath, dirname
import django import django
from django.conf import settings from django.conf import settings

View File

@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from __future__ import with_statement from __future__ import with_statement, absolute_import
import datetime import datetime
import decimal import decimal
import os import os
@ -10,24 +11,24 @@ from django.conf import settings
from django.template import Template, Context from django.template import Template, Context
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory
from django.test.utils import override_settings from django.test.utils import override_settings
from django.utils import translation
from django.utils.formats import (get_format, date_format, time_format, from django.utils.formats import (get_format, date_format, time_format,
localize, localize_input, iter_format_modules, get_format_modules) localize, localize_input, iter_format_modules, get_format_modules)
from django.utils.importlib import import_module from django.utils.importlib import import_module
from django.utils.numberformat import format as nformat from django.utils.numberformat import format as nformat
from django.utils.safestring import mark_safe, SafeString, SafeUnicode from django.utils.safestring import mark_safe, SafeString, SafeUnicode
from django.utils import translation
from django.utils.translation import (ugettext, ugettext_lazy, activate, from django.utils.translation import (ugettext, ugettext_lazy, activate,
deactivate, gettext_lazy, pgettext, npgettext, to_locale, deactivate, gettext_lazy, pgettext, npgettext, to_locale,
get_language_info, get_language, get_language_from_request) get_language_info, get_language, get_language_from_request)
from forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm from .commands.tests import NoWrapExtractorTests, IgnoredExtractorTests, MessageCompilationTests, PoFileTests, BasicExtractorTests, JavascriptExtractorTests, CopyPluralFormsExtractorTests, SymlinkExtractorTests, ExtractorTests
from models import Company, TestModel from .contenttypes.tests import ContentTypeTests
from .forms import I18nForm, SelectDateForm, SelectDateWidget, CompanyForm
from .models import Company, TestModel
from .patterns.tests import URLRedirectWithoutTrailingSlashTests, URLTranslationTests, URLDisabledTests, URLTagTests, URLTestCaseBase, URLRedirectWithoutTrailingSlashSettingTests, URLNamespaceTests, URLPrefixTests, URLResponseTests, URLRedirectTests
from .test_warnings import DeprecationWarningTests
from commands.tests import *
from patterns.tests import *
from contenttypes.tests import *
from test_warnings import DeprecationWarningTests
here = os.path.dirname(os.path.abspath(__file__)) here = os.path.dirname(os.path.abspath(__file__))

View File

@ -4,6 +4,7 @@ Regression tests for initial SQL insertion.
from django.db import models from django.db import models
class Simple(models.Model): class Simple(models.Model):
name = models.CharField(max_length = 50) name = models.CharField(max_length = 50)

View File

@ -1,6 +1,6 @@
from django.test import TestCase from django.test import TestCase
from models import Simple from .models import Simple
class InitialSQLTests(TestCase): class InitialSQLTests(TestCase):

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.forms.models import inlineformset_factory from django.forms.models import inlineformset_factory
from django.test import TestCase from django.test import TestCase
from regressiontests.inline_formsets.models import Poet, Poem, School, Parent, Child from .models import Poet, Poem, School, Parent, Child
class DeletionTests(TestCase): class DeletionTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Reporter(models.Model): class Reporter(models.Model):
first_name = models.CharField(max_length=30) first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30) last_name = models.CharField(max_length=30)

View File

@ -1,8 +1,11 @@
from __future__ import absolute_import
from functools import update_wrapper from functools import update_wrapper
from django.db import connection from django.db import connection
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from models import Reporter, Article from .models import Reporter, Article
# #
# The introspection module is optional, so methods tested here might raise # The introspection module is optional, so methods tested here might raise

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm from django.forms import ModelForm
from models import AustralianPlace
from .models import AustralianPlace
class AustralianPlaceForm(ModelForm): class AustralianPlaceForm(ModelForm):
""" Form for storing an Australian place. """ """ Form for storing an Australian place. """

View File

@ -1,5 +1,5 @@
from django.db import models
from django.contrib.localflavor.au.models import AUStateField, AUPostCodeField from django.contrib.localflavor.au.models import AUStateField, AUPostCodeField
from django.db import models
class AustralianPlace(models.Model): class AustralianPlace(models.Model):
state = AUStateField(blank=True) state = AUStateField(blank=True)

View File

@ -1,10 +1,13 @@
from __future__ import absolute_import
import re import re
from django.test import SimpleTestCase from django.test import SimpleTestCase
from django.contrib.localflavor.au.forms import (AUPostCodeField, from django.contrib.localflavor.au.forms import (AUPostCodeField,
AUPhoneNumberField, AUStateSelect) AUPhoneNumberField, AUStateSelect)
from forms import AustralianPlaceForm from .forms import AustralianPlaceForm
SELECTED_OPTION_PATTERN = r'<option value="%s" selected="selected">' SELECTED_OPTION_PATTERN = r'<option value="%s" selected="selected">'
BLANK_OPTION_PATTERN = r'<option value="">' BLANK_OPTION_PATTERN = r'<option value="">'

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm from django.forms import ModelForm
from models import MKPerson
from .models import MKPerson
class MKPersonForm(ModelForm): class MKPersonForm(ModelForm):

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.localflavor.mk.models import ( from django.contrib.localflavor.mk.models import (
MKIdentityCardNumberField, MKMunicipalityField, UMCNField) MKIdentityCardNumberField, MKMunicipalityField, UMCNField)
from django.db import models
class MKPerson(models.Model): class MKPerson(models.Model):
first_name = models.CharField(max_length = 20) first_name = models.CharField(max_length = 20)

View File

@ -1,10 +1,13 @@
from __future__ import absolute_import
from django.contrib.localflavor.mk.forms import ( from django.contrib.localflavor.mk.forms import (
MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField) MKIdentityCardNumberField, MKMunicipalitySelect, UMCNField)
from django.test import SimpleTestCase from django.test import SimpleTestCase
from forms import MKPersonForm from .forms import MKPersonForm
class MKLocalflavorTests(SimpleTestCase):
class MKLocalFlavorTests(SimpleTestCase):
def setUp(self): def setUp(self):
self.form = MKPersonForm({ self.form = MKPersonForm({

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm from django.forms import ModelForm
from models import MXPersonProfile
from .models import MXPersonProfile
class MXPersonProfileForm(ModelForm): class MXPersonProfileForm(ModelForm):

View File

@ -1,6 +1,7 @@
from django.db import models
from django.contrib.localflavor.mx.models import ( from django.contrib.localflavor.mx.models import (
MXStateField, MXRFCField, MXCURPField, MXZipCodeField) MXStateField, MXRFCField, MXCURPField, MXZipCodeField)
from django.db import models
class MXPersonProfile(models.Model): class MXPersonProfile(models.Model):
state = MXStateField() state = MXStateField()

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField, from django.contrib.localflavor.mx.forms import (MXZipCodeField, MXRFCField,
MXStateSelect, MXCURPField) MXStateSelect, MXCURPField)
from django.test import SimpleTestCase from django.test import SimpleTestCase
from forms import MXPersonProfileForm from .forms import MXPersonProfileForm
class MXLocalFlavorTests(SimpleTestCase): class MXLocalFlavorTests(SimpleTestCase):

View File

@ -1,42 +1,44 @@
from ar.tests import * from __future__ import absolute_import
from at.tests import *
from au.tests import * from .ar.tests import ARLocalFlavorTests
from be.tests import * from .at.tests import ATLocalFlavorTests
from br.tests import * from .au.tests import AULocalflavorTests
from ca.tests import * from .be.tests import BELocalFlavorTests
from ch.tests import * from .br.tests import BRLocalFlavorTests
from cl.tests import * from .ca.tests import CALocalFlavorTests
from cn.tests import * from .ch.tests import CHLocalFlavorTests
from co.tests import * from .cl.tests import CLLocalFlavorTests
from cz.tests import * from .cn.tests import CNLocalFlavorTests
from de.tests import * from .co.tests import COLocalFlavorTests
from ec.tests import * from .cz.tests import CZLocalFlavorTests
from es.tests import * from .de.tests import DELocalFlavorTests
from fi.tests import * from .ec.tests import ECLocalFlavorTests
from fr.tests import * from .es.tests import ESLocalFlavorTests
from gb.tests import * from .fi.tests import FILocalFlavorTests
from generic.tests import * from .fr.tests import FRLocalFlavorTests
from hr.tests import * from .gb.tests import GBLocalFlavorTests
from id.tests import * from .generic.tests import GenericLocalFlavorTests
from ie.tests import * from .hr.tests import HRLocalFlavorTests
from il.tests import * from .id.tests import IDLocalFlavorTests
from in_.tests import * from .ie.tests import IELocalFlavorTests
from is_.tests import * from .il.tests import ILLocalFlavorTests
from it.tests import * from .in_.tests import INLocalFlavorTests
from jp.tests import * from .is_.tests import ISLocalFlavorTests
from kw.tests import * from .it.tests import ITLocalFlavorTests
from mk.tests import * from .jp.tests import JPLocalFlavorTests
from mx.tests import * from .kw.tests import KWLocalFlavorTests
from nl.tests import * from .mk.tests import MKLocalFlavorTests
from pl.tests import * from .mx.tests import MXLocalFlavorTests
from pt.tests import * from .nl.tests import NLLocalFlavorTests
from py.tests import * from .pl.tests import PLLocalFlavorTests
from ro.tests import * from .pt.tests import PTLocalFlavorTests
from ru.tests import * from .py.tests import PYLocalFlavorTests
from se.tests import * from .ro.tests import ROLocalFlavorTests
from si.tests import * from .ru.tests import RULocalFlavorTests
from sk.tests import * from .se.tests import SELocalFlavorTests
from tr.tests import * from .si.tests import SILocalFlavorTests
from us.tests import * from .sk.tests import SKLocalFlavorTests
from uy.tests import * from .tr.tests import TRLocalFlavorTests
from za.tests import * from .us.tests import USLocalFlavorTests
from .uy.tests import UYLocalFlavorTests
from .za.tests import ZALocalFlavorTests

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.forms import ModelForm from django.forms import ModelForm
from models import USPlace
from .models import USPlace
class USPlaceForm(ModelForm): class USPlaceForm(ModelForm):

View File

@ -1,6 +1,5 @@
from django.contrib.localflavor.us.models import USStateField, USPostalCodeField
from django.db import models from django.db import models
from django.contrib.localflavor.us.models import USStateField
from django.contrib.localflavor.us.models import USPostalCodeField
# When creating models you need to remember to add a app_label as # When creating models you need to remember to add a app_label as
# 'localflavor', so your model can be found # 'localflavor', so your model can be found

View File

@ -1,11 +1,14 @@
from __future__ import absolute_import
from django.contrib.localflavor.us.forms import (USZipCodeField, from django.contrib.localflavor.us.forms import (USZipCodeField,
USPhoneNumberField, USStateField, USStateSelect, USPhoneNumberField, USStateField, USStateSelect,
USSocialSecurityNumberField) USSocialSecurityNumberField)
from django.test import SimpleTestCase from django.test import SimpleTestCase
from forms import USPlaceForm from .forms import USPlaceForm
class USLocalflavorTests(SimpleTestCase):
class USLocalFlavorTests(SimpleTestCase):
def setUp(self): def setUp(self):
self.form = USPlaceForm({'state':'GA', 'state_req':'NC', 'postal_code': 'GA', 'name':'impossible'}) self.form = USPlaceForm({'state':'GA', 'state_req':'NC', 'postal_code': 'GA', 'name':'impossible'})

View File

@ -3,11 +3,11 @@ from __future__ import with_statement
import copy import copy
from django.conf import compat_patch_logging_config from django.conf import compat_patch_logging_config
from django.test import TestCase
from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
from django.test.utils import override_settings
from django.core import mail from django.core import mail
from django.test import TestCase
from django.test.utils import override_settings
from django.utils.log import CallbackFilter, RequireDebugFalse, getLogger
# logging config prior to using filter with mail_admins # logging config prior to using filter with mail_admins

View File

@ -1,5 +1,5 @@
from django.db import models
from django.contrib.auth import models as auth from django.contrib.auth import models as auth
from django.db import models
# No related name is needed here, since symmetrical relations are not # No related name is needed here, since symmetrical relations are not
# explicitly reversible. # explicitly reversible.

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from django.test import TestCase from django.test import TestCase
from models import (SelfRefer, Tag, TagCollection, Entry, SelfReferChild, from .models import (SelfRefer, Tag, TagCollection, Entry, SelfReferChild,
SelfReferChildSibling, Worksheet) SelfReferChildSibling, Worksheet)

View File

@ -1,6 +1,5 @@
from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models
# Forward declared intermediate model # Forward declared intermediate model

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
try: try:
from cStringIO import StringIO from cStringIO import StringIO
except ImportError: except ImportError:
@ -7,8 +9,8 @@ from django.core import management
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.test import TestCase from django.test import TestCase
from models import (Person, Group, Membership, UserMembership, from .models import (Person, Group, Membership, UserMembership, Car, Driver,
Car, Driver, CarDriver) CarDriver)
class M2MThroughTestCase(TestCase): class M2MThroughTestCase(TestCase):

View File

@ -4,6 +4,7 @@ Various edge-cases for model managers.
from django.db import models from django.db import models
class OnlyFred(models.Manager): class OnlyFred(models.Manager):
def get_query_set(self): def get_query_set(self):
return super(OnlyFred, self).get_query_set().filter(name='fred') return super(OnlyFred, self).get_query_set().filter(name='fred')

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from models import Child1, Child2, Child3, Child4, Child5, Child6, Child7 from .models import Child1, Child2, Child3, Child4, Child5, Child6, Child7
class ManagersRegressionTests(TestCase): class ManagersRegressionTests(TestCase):

View File

@ -1,7 +1,10 @@
from __future__ import absolute_import
from django.db import models from django.db import models
from django.test import TestCase from django.test import TestCase
from models import First, Second, Third, Parent, Child, Category, Record, Relation from .models import First, Second, Third, Parent, Child, Category, Record, Relation
class ManyToOneRegressionTests(TestCase): class ManyToOneRegressionTests(TestCase):
def test_object_creation(self): def test_object_creation(self):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class PersonWithDefaultMaxLengths(models.Model): class PersonWithDefaultMaxLengths(models.Model):
email = models.EmailField() email = models.EmailField()
vcard = models.FileField(upload_to='/tmp') vcard = models.FileField(upload_to='/tmp')

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.utils import unittest from django.utils import unittest
from regressiontests.max_lengths.models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths from .models import PersonWithDefaultMaxLengths, PersonWithCustomMaxLengths
class MaxLengthArgumentsTests(unittest.TestCase): class MaxLengthArgumentsTests(unittest.TestCase):

View File

@ -1,7 +1,9 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns from django.conf.urls import patterns
import views from . import views
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^middleware_exceptions/view/$', views.normal_view), (r'^middleware_exceptions/view/$', views.normal_view),

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os import os
import shutil import shutil
@ -5,14 +7,14 @@ from django.core.files import File
from django.core.files.images import ImageFile from django.core.files.images import ImageFile
from django.test import TestCase from django.test import TestCase
from models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth, from .models import (Image, Person, PersonWithHeight, PersonWithHeightAndWidth,
PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile) PersonDimensionsFirst, PersonTwoImages, TestImageFieldFile)
# If PIL available, do these tests. # If PIL available, do these tests.
if Image: if Image:
from models import temp_storage_dir from .models import temp_storage_dir
class ImageFieldTestMixin(object): class ImageFieldTestMixin(object):

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
from decimal import Decimal from decimal import Decimal
@ -8,14 +10,15 @@ from django.db import models
from django.db.models.fields.files import FieldFile from django.db.models.fields.files import FieldFile
from django.utils import unittest from django.utils import unittest
from models import Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post, NullBooleanModel, BooleanModel, Document, RenamedField from .models import (Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post,
NullBooleanModel, BooleanModel, Document, RenamedField)
# If PIL available, do these tests. # If PIL available, do these tests.
if Image: if Image:
from imagefield import ( from .imagefield import (ImageFieldTests, ImageFieldTwoDimensionsTests,
ImageFieldTests, ImageFieldTwoDimensionsTests, TwoImageFieldTests, TwoImageFieldTests, ImageFieldNoDimensionsTests,
ImageFieldNoDimensionsTests, ImageFieldOneDimensionTests, ImageFieldOneDimensionTests, ImageFieldDimensionsFirstTests,
ImageFieldDimensionsFirstTests, ImageFieldUsingFileTests) ImageFieldUsingFileTests)
class BasicFieldTests(test.TestCase): class BasicFieldTests(test.TestCase):

View File

@ -1,6 +1,7 @@
import os import os
from django.db import models
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models
class Person(models.Model): class Person(models.Model):

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
from datetime import date from datetime import date
from django import forms from django import forms
@ -8,7 +10,7 @@ from django.forms.models import (modelform_factory, ModelChoiceField,
from django.utils import unittest from django.utils import unittest
from django.test import TestCase from django.test import TestCase
from models import (Person, RealPerson, Triple, FilePathModel, Article, from .models import (Person, RealPerson, Triple, FilePathModel, Article,
Publication, CustomFF, Author, Author1, Homepage, Document, Edition) Publication, CustomFF, Author, Author1, Homepage, Document, Edition)

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class User(models.Model): class User(models.Model):
username = models.CharField(max_length=12, unique=True) username = models.CharField(max_length=12, unique=True)
serial = models.IntegerField() serial = models.IntegerField()

View File

@ -1,10 +1,12 @@
from __future__ import absolute_import
from django import forms from django import forms
from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME from django.forms.formsets import BaseFormSet, DELETION_FIELD_NAME
from django.forms.util import ErrorDict, ErrorList from django.forms.util import ErrorDict, ErrorList
from django.forms.models import modelform_factory, inlineformset_factory, modelformset_factory, BaseModelFormSet from django.forms.models import modelform_factory, inlineformset_factory, modelformset_factory, BaseModelFormSet
from django.test import TestCase from django.test import TestCase
from models import User, UserSite, Restaurant, Manager, Network, Host from .models import User, UserSite, Restaurant, Manager, Network, Host
class InlineFormsetTests(TestCase): class InlineFormsetTests(TestCase):

View File

@ -2,12 +2,14 @@
Regression tests for Model inheritance behaviour. Regression tests for Model inheritance behaviour.
""" """
from __future__ import absolute_import
import datetime import datetime
from operator import attrgetter from operator import attrgetter
from django.test import TestCase from django.test import TestCase
from models import (Place, Restaurant, ItalianRestaurant, ParkingLot, from .models import (Place, Restaurant, ItalianRestaurant, ParkingLot,
ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent, ParkingLot2, ParkingLot3, Supplier, Wholesaler, Child, SelfRefParent,
SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM, SelfRefChild, ArticleWithAuthor, M2MChild, QualityControl, DerivedM,
Person, BirthdayParty, BachelorParty, MessyBachelorParty, Person, BirthdayParty, BachelorParty, MessyBachelorParty,

View File

@ -5,6 +5,7 @@ select_related().
from django.db import models from django.db import models
class Place(models.Model): class Place(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)

View File

@ -1,8 +1,10 @@
from __future__ import absolute_import
from operator import attrgetter from operator import attrgetter
from django.test import TestCase from django.test import TestCase
from models import Restaurant, Person from .models import Restaurant, Person
class ModelInheritanceSelectRelatedTests(TestCase): class ModelInheritanceSelectRelatedTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Guitarist(models.Model): class Guitarist(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
slug = models.CharField(max_length=50) slug = models.CharField(max_length=50)

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from regressiontests.model_permalink.models import Guitarist
from .models import Guitarist
class PermalinkTests(TestCase): class PermalinkTests(TestCase):
urls = 'regressiontests.model_permalink.urls' urls = 'regressiontests.model_permalink.urls'

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
from operator import attrgetter from operator import attrgetter
@ -5,7 +7,7 @@ from django.core.exceptions import ValidationError
from django.test import TestCase, skipUnlessDBFeature from django.test import TestCase, skipUnlessDBFeature
from django.utils import tzinfo from django.utils import tzinfo
from models import (Worker, Article, Party, Event, Department, from .models import (Worker, Article, Party, Event, Department,
BrokenUnicodeMethod, NonAutoPK) BrokenUnicodeMethod, NonAutoPK)

View File

@ -1,6 +1,7 @@
# coding: utf-8 # coding: utf-8
from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models
class Band(models.Model): class Band(models.Model):
name = models.CharField(max_length=100) name = models.CharField(max_length=100)

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
from datetime import date from datetime import date
from django import forms from django import forms
@ -15,8 +17,7 @@ from django.forms.widgets import Select
from django.test import TestCase from django.test import TestCase
from django.utils import unittest from django.utils import unittest
from models import (Band, Concert, ValidationTestModel, from .models import Band, Concert, ValidationTestModel, ValidationTestInlineModel
ValidationTestInlineModel)
class MockRequest(object): class MockRequest(object):

View File

@ -1,8 +1,11 @@
from __future__ import absolute_import
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic from django.contrib.contenttypes import generic
from django.db import models from django.db import models
class Review(models.Model): class Review(models.Model):
source = models.CharField(max_length=100) source = models.CharField(max_length=100)
content_type = models.ForeignKey(ContentType) content_type = models.ForeignKey(ContentType)

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
import pickle import pickle
from StringIO import StringIO from StringIO import StringIO
@ -9,7 +11,7 @@ from django.db import connections, router, DEFAULT_DB_ALIAS
from django.db.models import signals from django.db.models import signals
from django.test import TestCase from django.test import TestCase
from models import Book, Person, Pet, Review, UserProfile from .models import Book, Person, Pet, Review, UserProfile
class QueryTestCase(TestCase): class QueryTestCase(TestCase):

View File

@ -4,6 +4,7 @@ Regression tests for proper working of ForeignKey(null=True).
from django.db import models from django.db import models
class SystemDetails(models.Model): class SystemDetails(models.Model):
details = models.TextField() details = models.TextField()

View File

@ -1,7 +1,11 @@
from django.test import TestCase from __future__ import absolute_import
from django.db.models import Q
from django.db.models import Q
from django.test import TestCase
from .models import (SystemDetails, Item, PropertyValue, SystemInfo, Forum,
Post, Comment)
from regressiontests.null_fk.models import *
class NullFkTests(TestCase): class NullFkTests(TestCase):

View File

@ -8,6 +8,7 @@ xpected results
from django.db import models from django.db import models
# The first two models represent a very simple null FK ordering case. # The first two models represent a very simple null FK ordering case.
class Author(models.Model): class Author(models.Model):
name = models.CharField(max_length=150) name = models.CharField(max_length=150)

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from regressiontests.null_fk_ordering.models import * from .models import Author, Article, SystemInfo, Forum, Post, Comment
class NullFkOrderingTests(TestCase): class NullFkOrderingTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Poll(models.Model): class Poll(models.Model):
question = models.CharField(max_length=200) question = models.CharField(max_length=200)

View File

@ -1,7 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from django.core.exceptions import FieldError from django.core.exceptions import FieldError
from regressiontests.null_queries.models import * from .models import Poll, Choice, OuterA, Inner, OuterB
class NullQueriesTests(TestCase): class NullQueriesTests(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Place(models.Model): class Place(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
address = models.CharField(max_length=80) address = models.CharField(max_length=80)

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from regressiontests.one_to_one_regress.models import *
from .models import Place, Restaurant, Bar, Favorites, Target, UndergroundBar
class OneToOneRegressionTests(TestCase): class OneToOneRegressionTests(TestCase):

View File

@ -6,6 +6,7 @@ import threading
from django.db import models from django.db import models
class DumbCategory(models.Model): class DumbCategory(models.Model):
pass pass
@ -342,4 +343,4 @@ class OneToOneCategory(models.Model):
def __unicode__(self): def __unicode__(self):
return "one2one " + self.new_name return "one2one " + self.new_name

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import datetime import datetime
import pickle import pickle
import sys import sys
@ -11,11 +13,12 @@ from django.test import TestCase, skipUnlessDBFeature
from django.utils import unittest from django.utils import unittest
from django.utils.datastructures import SortedDict from django.utils.datastructures import SortedDict
from models import (Annotation, Article, Author, Celebrity, Child, Cover, Detail, from .models import (Annotation, Article, Author, Celebrity, Child, Cover,
DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ, ManagedModel, Detail, DumbCategory, ExtraInfo, Fan, Item, LeafA, LoopX, LoopZ,
Member, NamedCategory, Note, Number, Plaything, PointerA, Ranking, Related, ManagedModel, Member, NamedCategory, Note, Number, Plaything, PointerA,
Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten, Node, ObjectA, ObjectB, Ranking, Related, Report, ReservedName, Tag, TvChef, Valid, X, Food, Eaten,
ObjectC, CategoryItem, SimpleCategory, SpecialCategory, OneToOneCategory) Node, ObjectA, ObjectB, ObjectC, CategoryItem, SimpleCategory,
SpecialCategory, OneToOneCategory)
class BaseQuerysetTest(TestCase): class BaseQuerysetTest(TestCase):

View File

@ -1,7 +1,11 @@
from __future__ import absolute_import
import datetime import datetime
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
def standalone_number(self): def standalone_number(self):
return 1 return 1

View File

@ -1,9 +1,11 @@
from __future__ import absolute_import
import pickle import pickle
import datetime import datetime
from django.test import TestCase from django.test import TestCase
from models import Group, Event, Happening from .models import Group, Event, Happening
class PickleabilityTestCase(TestCase): class PickleabilityTestCase(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class SourceManager(models.Manager): class SourceManager(models.Manager):
def get_query_set(self): def get_query_set(self):
return super(SourceManager, self).get_query_set().filter(is_public=True) return super(SourceManager, self).get_query_set().filter(is_public=True)

View File

@ -1,6 +1,9 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from regressiontests.reverse_single_related.models import * from .models import Source, Item
class ReverseSingleRelatedTests(TestCase): class ReverseSingleRelatedTests(TestCase):
""" """

View File

@ -1,6 +1,8 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from models import (User, UserProfile, UserStat, UserStatResult, StatDetails, from .models import (User, UserProfile, UserStat, UserStatResult, StatDetails,
AdvancedUserStat, Image, Product) AdvancedUserStat, Image, Product)
class ReverseSelectRelatedTestCase(TestCase): class ReverseSelectRelatedTestCase(TestCase):

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Building(models.Model): class Building(models.Model):
name = models.CharField(max_length=10) name = models.CharField(max_length=10)

View File

@ -1,5 +1,11 @@
from __future__ import absolute_import
from django.test import TestCase from django.test import TestCase
from regressiontests.select_related_regress.models import *
from .models import (Building, Child, Device, Port, Item, Country, Connection,
ClientStatus, State, Client, SpecialClient, TUser, Person, Student,
Organizer, Class, Enrollment)
class SelectRelatedRegressTests(TestCase): class SelectRelatedRegressTests(TestCase):

View File

@ -8,7 +8,7 @@ forward, backwards and self references.
""" """
# This is necessary in Python 2.5 to enable the with statement, in 2.6 # This is necessary in Python 2.5 to enable the with statement, in 2.6
# and up it is no longer necessary. # and up it is no longer necessary.
from __future__ import with_statement from __future__ import with_statement, absolute_import
import datetime import datetime
import decimal import decimal
@ -19,11 +19,23 @@ except ImportError:
from django.core import serializers from django.core import serializers
from django.core.serializers import SerializerDoesNotExist from django.core.serializers import SerializerDoesNotExist
from django.db import connection from django.db import connection, models
from django.test import TestCase from django.test import TestCase
from django.utils.functional import curry from django.utils.functional import curry
from models import * from .models import (BooleanData, CharData, DateData, DateTimeData, EmailData,
FileData, FilePathData, DecimalData, FloatData, IntegerData, IPAddressData,
GenericIPAddressData, NullBooleanData, PhoneData, PositiveIntegerData,
PositiveSmallIntegerData, SlugData, SmallData, TextData, TimeData,
USStateData, GenericData, Anchor, UniqueAnchor, FKData, M2MData, O2OData,
FKSelfData, M2MSelfData, FKDataToField, FKDataToO2O, M2MIntermediateData,
Intermediate, BooleanPKData, CharPKData, EmailPKData, FilePathPKData,
DecimalPKData, FloatPKData, IntegerPKData, IPAddressPKData,
GenericIPAddressPKData, PhonePKData, PositiveIntegerPKData,
PositiveSmallIntegerPKData, SlugPKData, SmallPKData, USStatePKData,
AutoNowDateTimeData, ModifyingSaveData, InheritAbstractModel,
ExplicitInheritBaseModel, InheritBaseModel, BigIntegerData, LengthModel,
Tag, ComplexModel)
# A set of functions that can be used to recreate # A set of functions that can be used to recreate
# test data objects of various kinds. # test data objects of various kinds.

View File

@ -1,5 +1,7 @@
from __future__ import with_statement from __future__ import with_statement
import os import os
from django.conf import settings, global_settings from django.conf import settings, global_settings
from django.test import TransactionTestCase, TestCase, signals from django.test import TransactionTestCase, TestCase, signals
from django.test.utils import override_settings from django.test.utils import override_settings

View File

@ -1,5 +1,6 @@
from django.db import models from django.db import models
class Author(models.Model): class Author(models.Model):
name = models.CharField(max_length=20) name = models.CharField(max_length=20)

View File

@ -1,7 +1,10 @@
from django.test import TestCase from __future__ import absolute_import
from django.db import models from django.db import models
from regressiontests.signals_regress.models import Author, Book from django.test import TestCase
from .models import Author, Book
signal_output = [] signal_output = []

View File

@ -4,6 +4,7 @@ from django.core import signing
from django.http import HttpRequest, HttpResponse from django.http import HttpRequest, HttpResponse
from django.test import TestCase from django.test import TestCase
class SignedCookieTest(TestCase): class SignedCookieTest(TestCase):
def test_can_set_and_read_signed_cookies(self): def test_can_set_and_read_signed_cookies(self):

View File

@ -4,6 +4,7 @@ from django.core import signing
from django.test import TestCase from django.test import TestCase
from django.utils.encoding import force_unicode from django.utils.encoding import force_unicode
class TestSigner(TestCase): class TestSigner(TestCase):
def test_signature(self): def test_signature(self):

View File

@ -1,18 +1,22 @@
from __future__ import absolute_import
from django.conf import settings from django.conf import settings
from django.contrib.sites.models import Site from django.contrib.sites.models import Site
from django.test import TestCase from django.test import TestCase
from models import SyndicatedArticle, ExclusiveArticle, CustomArticle, InvalidArticle, ConfusedArticle from .models import (SyndicatedArticle, ExclusiveArticle, CustomArticle,
InvalidArticle, ConfusedArticle)
class SitesFrameworkTestCase(TestCase): class SitesFrameworkTestCase(TestCase):
def setUp(self): def setUp(self):
Site.objects.get_or_create(id=settings.SITE_ID, domain="example.com", name="example.com") Site.objects.get_or_create(id=settings.SITE_ID, domain="example.com", name="example.com")
Site.objects.create(id=settings.SITE_ID+1, domain="example2.com", name="example2.com") Site.objects.create(id=settings.SITE_ID+1, domain="example2.com", name="example2.com")
def test_site_fk(self): def test_site_fk(self):
article = ExclusiveArticle.objects.create(title="Breaking News!", site_id=settings.SITE_ID) article = ExclusiveArticle.objects.create(title="Breaking News!", site_id=settings.SITE_ID)
self.assertEqual(ExclusiveArticle.on_site.all().get(), article) self.assertEqual(ExclusiveArticle.on_site.all().get(), article)
def test_sites_m2m(self): def test_sites_m2m(self):
article = SyndicatedArticle.objects.create(title="Fresh News!") article = SyndicatedArticle.objects.create(title="Fresh News!")
article.sites.add(Site.objects.get(id=settings.SITE_ID)) article.sites.add(Site.objects.get(id=settings.SITE_ID))
@ -20,15 +24,15 @@ class SitesFrameworkTestCase(TestCase):
article2 = SyndicatedArticle.objects.create(title="More News!") article2 = SyndicatedArticle.objects.create(title="More News!")
article2.sites.add(Site.objects.get(id=settings.SITE_ID+1)) article2.sites.add(Site.objects.get(id=settings.SITE_ID+1))
self.assertEqual(SyndicatedArticle.on_site.all().get(), article) self.assertEqual(SyndicatedArticle.on_site.all().get(), article)
def test_custom_named_field(self): def test_custom_named_field(self):
article = CustomArticle.objects.create(title="Tantalizing News!", places_this_article_should_appear_id=settings.SITE_ID) article = CustomArticle.objects.create(title="Tantalizing News!", places_this_article_should_appear_id=settings.SITE_ID)
self.assertEqual(CustomArticle.on_site.all().get(), article) self.assertEqual(CustomArticle.on_site.all().get(), article)
def test_invalid_name(self): def test_invalid_name(self):
article = InvalidArticle.objects.create(title="Bad News!", site_id=settings.SITE_ID) article = InvalidArticle.objects.create(title="Bad News!", site_id=settings.SITE_ID)
self.assertRaises(ValueError, InvalidArticle.on_site.all) self.assertRaises(ValueError, InvalidArticle.on_site.all)
def test_invalid_field_type(self): def test_invalid_field_type(self):
article = ConfusedArticle.objects.create(title="More Bad News!", site=settings.SITE_ID) article = ConfusedArticle.objects.create(title="More Bad News!", site=settings.SITE_ID)
self.assertRaises(TypeError, ConfusedArticle.on_site.all) self.assertRaises(TypeError, ConfusedArticle.on_site.all)

View File

@ -1,4 +1,5 @@
from django.db import models from django.db import models
class Article(models.Model): class Article(models.Model):
text = models.TextField() text = models.TextField()

View File

@ -1,7 +1,7 @@
import warnings import warnings
from django.test import TestCase
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.test import TestCase
class SpecialHeadersTest(TestCase): class SpecialHeadersTest(TestCase):

View File

@ -1,8 +1,11 @@
# coding: utf-8 # coding: utf-8
from __future__ import absolute_import
from django.conf.urls import patterns from django.conf.urls import patterns
from django.views.generic.list_detail import object_detail from django.views.generic.list_detail import object_detail
from models import Article
import views from . import views
from .models import Article
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^special_headers/article/(?P<object_id>\d+)/$', object_detail, {'queryset': Article.objects.all()}), (r'^special_headers/article/(?P<object_id>\d+)/$', object_detail, {'queryset': Article.objects.all()}),

View File

@ -1,5 +1,6 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
from __future__ import with_statement from __future__ import with_statement
import codecs import codecs
import os import os
import posixpath import posixpath

View File

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.db import models from django.db import models
class Foo(models.Model): class Foo(models.Model):
name = models.CharField(max_length=50) name = models.CharField(max_length=50)
friend = models.CharField(max_length=50, blank=True) friend = models.CharField(max_length=50, blank=True)

Some files were not shown because too many files have changed in this diff Show More