diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-13 18:51:33 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-13 18:51:33 +0000 |
| commit | d362c1546f8ad62811e5dee3cf0b43170e6e1c4c (patch) | |
| tree | c14af91e991cb534a135cc0ca467aa6263007b07 /tests/regressiontests/admin_views | |
| parent | d5a45d79fe03cad93ab5761860e9bb6fc1db4c86 (diff) | |
Convert much of the regression tests to use absolute imports. There's still work to be done though.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16976 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/admin_views')
| -rw-r--r-- | tests/regressiontests/admin_views/admin.py | 18 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/customadmin.py | 5 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/forms.py | 1 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/models.py | 4 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/tests.py | 36 | ||||
| -rw-r--r-- | tests/regressiontests/admin_views/urls.py | 8 |
6 files changed, 45 insertions, 27 deletions
diff --git a/tests/regressiontests/admin_views/admin.py b/tests/regressiontests/admin_views/admin.py index e4aae4fed9..f506fb2078 100644 --- a/tests/regressiontests/admin_views/admin.py +++ b/tests/regressiontests/admin_views/admin.py @@ -1,14 +1,28 @@ # -*- coding: utf-8 -*- +from __future__ import absolute_import + import datetime import tempfile import os +from django import forms from django.contrib import admin from django.contrib.admin.views.main import ChangeList -from django.forms.models import BaseModelFormSet +from django.core.files.storage import FileSystemStorage from django.core.mail import EmailMessage +from django.db import models +from django.forms.models import BaseModelFormSet -from models import * +from .models import (Article, Chapter, Account, Media, Child, Parent, Picture, + Widget, DooHickey, Grommet, Whatsit, FancyDoodad, Category, Link, + PrePopulatedPost, PrePopulatedSubPost, CustomArticle, Section, + ModelWithStringPrimaryKey, Color, Thing, Actor, Inquisition, Sketch, Person, + Persona, Subscriber, ExternalSubscriber, OldSubscriber, Vodcast, EmptyModel, + Fabric, Gallery, Language, Recommendation, Recommender, Collector, Post, + Gadget, Villain, SuperVillain, Plot, PlotDetails, CyclicOne, CyclicTwo, + WorkHour, Reservation, FoodDelivery, RowLevelChangePermissionModel, Paper, + CoverLetter, Story, OtherStory, Book, Promo, ChapterXtra1, Pizza, Topping, + Album, Question, Answer, ComplexSortedPerson) def callable_year(dt_value): diff --git a/tests/regressiontests/admin_views/customadmin.py b/tests/regressiontests/admin_views/customadmin.py index a696e9f565..38ed38a8a4 100644 --- a/tests/regressiontests/admin_views/customadmin.py +++ b/tests/regressiontests/admin_views/customadmin.py @@ -1,11 +1,14 @@ """ A second, custom AdminSite -- see tests.CustomAdminSiteTests. """ +from __future__ import absolute_import + from django.conf.urls import patterns from django.contrib import admin from django.http import HttpResponse -import models, forms, admin as base_admin +from . import models, forms, admin as base_admin + class Admin2(admin.AdminSite): login_form = forms.CustomAdminAuthenticationForm diff --git a/tests/regressiontests/admin_views/forms.py b/tests/regressiontests/admin_views/forms.py index a030c2a8d0..e8493df95b 100644 --- a/tests/regressiontests/admin_views/forms.py +++ b/tests/regressiontests/admin_views/forms.py @@ -1,6 +1,7 @@ from django import forms from django.contrib.admin.forms import AdminAuthenticationForm + class CustomAdminAuthenticationForm(AdminAuthenticationForm): def clean_username(self): diff --git a/tests/regressiontests/admin_views/models.py b/tests/regressiontests/admin_views/models.py index bb8d026e26..8224383209 100644 --- a/tests/regressiontests/admin_views/models.py +++ b/tests/regressiontests/admin_views/models.py @@ -3,12 +3,12 @@ import datetime import tempfile import os -from django.core.files.storage import FileSystemStorage -from django.db import models from django import forms from django.contrib.auth.models import User from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType +from django.core.files.storage import FileSystemStorage +from django.db import models class Section(models.Model): diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py index b15e97af1f..52664a0207 100644 --- a/tests/regressiontests/admin_views/tests.py +++ b/tests/regressiontests/admin_views/tests.py @@ -1,5 +1,5 @@ # coding: utf-8 -from __future__ import with_statement +from __future__ import with_statement, absolute_import import re import datetime @@ -11,39 +11,37 @@ from django.core.exceptions import SuspiciousOperation from django.core.files import temp as tempfile from django.core.urlresolvers import reverse # Register auth models with the admin. -from django.contrib.auth import REDIRECT_FIELD_NAME, admin -from django.contrib.auth.models import Group, User, Permission, UNUSABLE_PASSWORD -from django.contrib.contenttypes.models import ContentType +from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.models import LogEntry, DELETION from django.contrib.admin.sites import LOGIN_FORM_KEY from django.contrib.admin.util import quote -from django.contrib.admin.helpers import ACTION_CHECKBOX_NAME from django.contrib.admin.views.main import IS_POPUP_VAR +from django.contrib.auth import REDIRECT_FIELD_NAME, admin +from django.contrib.auth.models import Group, User, Permission, UNUSABLE_PASSWORD +from django.contrib.contenttypes.models import ContentType from django.forms.util import ErrorList -import django.template.context +from django.template import context as context_module from django.template.response import TemplateResponse from django.test import TestCase -from django.utils import formats, translation +from django.utils import formats, translation, unittest from django.utils.cache import get_max_age from django.utils.encoding import iri_to_uri from django.utils.html import escape from django.utils.http import urlencode -from django.utils import unittest # local test models -from models import (Article, BarAccount, CustomArticle, EmptyModel, - FooAccount, Gallery, ModelWithStringPrimaryKey, - Person, Persona, Picture, Podcast, Section, Subscriber, Vodcast, - Language, Collector, Widget, Grommet, DooHickey, FancyDoodad, Whatsit, - Category, Post, Plot, FunkyTag, Chapter, Book, Promo, WorkHour, Employee, - Question, Answer, Inquisition, Actor, FoodDelivery, - RowLevelChangePermissionModel, Paper, CoverLetter, Story, OtherStory, - ComplexSortedPerson, Parent, Child) +from .models import (Article, BarAccount, CustomArticle, EmptyModel, FooAccount, + Gallery, ModelWithStringPrimaryKey, Person, Persona, Picture, Podcast, + Section, Subscriber, Vodcast, Language, Collector, Widget, Grommet, + DooHickey, FancyDoodad, Whatsit, Category, Post, Plot, FunkyTag, Chapter, + Book, Promo, WorkHour, Employee, Question, Answer, Inquisition, Actor, + FoodDelivery, RowLevelChangePermissionModel, Paper, CoverLetter, Story, + OtherStory, ComplexSortedPerson, Parent, Child) + ERROR_MESSAGE = "Please enter the correct username and password \ for a staff account. Note that both fields are case-sensitive." - class AdminViewBasicTest(TestCase): fixtures = ['admin-views-users.xml', 'admin-views-colors.xml', 'admin-views-fabrics.xml', 'admin-views-books.xml'] @@ -3073,7 +3071,7 @@ class ValidXHTMLTests(TestCase): cp.remove('django.core.context_processors.i18n') settings.TEMPLATE_CONTEXT_PROCESSORS = tuple(cp) # Force re-evaluation of the contex processor list - django.template.context._standard_context_processors = None + context_module._standard_context_processors = None self.client.login(username='super', password='secret') def tearDown(self): @@ -3081,7 +3079,7 @@ class ValidXHTMLTests(TestCase): if self._context_processors is not None: settings.TEMPLATE_CONTEXT_PROCESSORS = self._context_processors # Force re-evaluation of the contex processor list - django.template.context._standard_context_processors = None + context_module._standard_context_processors = None settings.USE_I18N = self._use_i18n def testLangNamePresent(self): diff --git a/tests/regressiontests/admin_views/urls.py b/tests/regressiontests/admin_views/urls.py index e436665d6d..03bfbf0812 100644 --- a/tests/regressiontests/admin_views/urls.py +++ b/tests/regressiontests/admin_views/urls.py @@ -1,7 +1,9 @@ +from __future__ import absolute_import + from django.conf.urls import patterns, include -import views -import customadmin -import admin + +from . import views, customadmin, admin + urlpatterns = patterns('', (r'^test_admin/admin/doc/', include('django.contrib.admindocs.urls')), |
