Remove a great many of the remaining relative imports.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17008 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Alex Gaynor 2011-10-17 18:45:22 +00:00
parent 544a8372fd
commit 66210cbc70
17 changed files with 104 additions and 43 deletions

View File

@ -1,16 +1,20 @@
from __future__ import absolute_import
from django import http
from django.conf import settings
from utils import next_redirect, confirmation_view
from django.contrib import comments
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.core.exceptions import ObjectDoesNotExist, ValidationError
from django.db import models
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.template.loader import render_to_string
from django.utils.html import escape
from django.views.decorators.http import require_POST
from django.contrib import comments
from django.contrib.comments import signals
from django.views.decorators.csrf import csrf_protect
from django.views.decorators.http import require_POST
class CommentPostBadRequest(http.HttpResponseBadRequest):
"""

View File

@ -1,12 +1,16 @@
from __future__ import absolute_import
from django import template
from django.conf import settings
from django.shortcuts import get_object_or_404, render_to_response
from django.contrib.auth.decorators import login_required, permission_required
from utils import next_redirect, confirmation_view
from django.contrib import comments
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.comments import signals
from django.contrib.comments.views.utils import next_redirect, confirmation_view
from django.shortcuts import get_object_or_404, render_to_response
from django.views.decorators.csrf import csrf_protect
@csrf_protect
@login_required
def flag(request, comment_id, next=None):

View File

@ -2,11 +2,14 @@
This is a URLconf to be loaded by tests.py. Add any URLs needed for tests only.
"""
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.contrib.formtools.tests import TestFormPreview, TestWizardClass
from forms import (ContactWizard, Page1, Page2, Page3, TestForm,
WizardPageOneForm, WizardPageTwoForm, WizardPageThreeForm)
from django.contrib.formtools.tests.forms import (ContactWizard, Page1, Page2,
Page3, TestForm, WizardPageOneForm, WizardPageTwoForm, WizardPageThreeForm)
urlpatterns = patterns('',
url(r'^preview/', TestFormPreview(TestForm)),

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
from django.db import connection
from django.db.models import Q
from django.contrib.gis.geos import GEOSGeometry, LineString
@ -5,9 +7,10 @@ from django.contrib.gis.measure import D # alias for Distance
from django.contrib.gis.tests.utils import oracle, postgis, spatialite, no_oracle, no_spatialite
from django.test import TestCase
from models import (AustraliaCity, Interstate, SouthTexasInterstate,
from .models import (AustraliaCity, Interstate, SouthTexasInterstate,
SouthTexasCity, SouthTexasCityFt, CensusZipcode, SouthTexasZipcode)
class DistanceTest(TestCase):
# A point we are testing distances with -- using a WGS84

View File

@ -1,13 +1,15 @@
from __future__ import absolute_import
import os
import re
from django.utils.unittest import TestCase
from django.contrib.gis.db.models import Union, Extent3D
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
from models import (City3D, Interstate2D, Interstate3D,
InterstateProj2D, InterstateProj3D,
Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D)
from .models import (City3D, Interstate2D, Interstate3D, InterstateProj2D,
InterstateProj3D, Point2D, Point3D, MultiPoint3D, Polygon2D, Polygon3D)
data_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'data'))
city_file = os.path.join(data_path, 'cities', 'cities.shp')
@ -106,7 +108,7 @@ class Geo3DTest(TestCase):
def test01a_3d_layermapping(self):
"Testing LayerMapping on 3D models."
from models import Point2D, Point3D
from .models import Point2D, Point3D
point_mapping = {'point' : 'POINT'}
mpoint_mapping = {'mpoint' : 'MULTIPOINT'}

View File

@ -1,6 +1,10 @@
from __future__ import absolute_import
from django.test import TestCase
from django.contrib.gis import admin
from models import City
from .models import City
class GeoAdminTest(TestCase):
urls = 'django.contrib.gis.tests.geoadmin.urls'

View File

@ -1,5 +1,9 @@
from __future__ import absolute_import
from django.contrib.gis import feeds
from models import City
from .models import City
class TestGeoRSS1(feeds.Feed):
link = '/city/'

View File

@ -1,6 +1,10 @@
from __future__ import absolute_import
from django.contrib.gis.sitemaps import GeoRSSSitemap, KMLSitemap, KMZSitemap
from models import City, Country
from feeds import feed_dict
from .feeds import feed_dict
from .models import City, Country
sitemaps = {'kml' : KMLSitemap([City, Country]),
'kmz' : KMZSitemap([City, Country]),

View File

@ -1,9 +1,12 @@
from __future__ import absolute_import
from xml.dom import minidom
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from models import City
from .models import City
class GeoFeedTest(TestCase):

View File

@ -1,8 +1,13 @@
from __future__ import absolute_import
from datetime import datetime
from django.contrib.gis.tests.utils import no_mysql, no_spatialite
from django.contrib.gis.shortcuts import render_to_kmz
from django.test import TestCase
from models import City, PennsylvaniaCity, State
from .models import City, PennsylvaniaCity, State
class GeoRegressionTests(TestCase):

View File

@ -1,14 +1,17 @@
from __future__ import absolute_import
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from xml.dom import minidom
import zipfile
from django.conf import settings
from django.contrib.sites.models import Site
from django.test import TestCase
from models import City, Country
from .models import City, Country
class GeoSitemapTest(TestCase):
@ -78,7 +81,7 @@ class GeoSitemapTest(TestCase):
def test_geositemap_georss(self):
"Tests GeoRSS geographic sitemaps."
from feeds import feed_dict
from .feeds import feed_dict
doc = minidom.parseString(self.client.get('/sitemaps/georss.xml').content)

View File

@ -1,4 +1,7 @@
from __future__ import absolute_import
import re
from django.db import connection
from django.db.utils import DatabaseError
from django.contrib.gis import gdal
@ -9,10 +12,10 @@ from django.contrib.gis.tests.utils import (
mysql, oracle, postgis, spatialite)
from django.test import TestCase
from models import Country, City, PennsylvaniaCity, State, Track
from .models import Country, City, PennsylvaniaCity, State, Track
if not spatialite:
from models import Feature, MinusOneSRID
from .models import Feature, MinusOneSRID
class GeoModelTest(TestCase):
@ -733,6 +736,6 @@ class GeoModelTest(TestCase):
self.assertEqual(ref_hash, h1.geohash)
self.assertEqual(ref_hash[:5], h2.geohash)
from test_feeds import GeoFeedTest
from test_regress import GeoRegressionTests
from test_sitemaps import GeoSitemapTest
from .test_feeds import GeoFeedTest
from .test_regress import GeoRegressionTests
from .test_sitemaps import GeoSitemapTest

View File

@ -1,11 +1,15 @@
from __future__ import absolute_import
from django.conf.urls import patterns
from feeds import feed_dict
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatterns = patterns('',
(r'^feeds/(?P<url>.*)/$', 'django.contrib.gis.views.feed', {'feed_dict': feed_dict}),
)
from sitemaps import sitemaps
urlpatterns += patterns('django.contrib.gis.sitemaps.views',
(r'^sitemap.xml$', 'index', {'sitemaps' : sitemaps}),
(r'^sitemaps/(?P<section>\w+)\.xml$', 'sitemap', {'sitemaps' : sitemaps}),

View File

@ -1,11 +1,16 @@
"""
Tests for geography support in PostGIS 1.5+
"""
from __future__ import absolute_import
import os
from django.contrib.gis import gdal
from django.contrib.gis.measure import D
from django.test import TestCase
from models import City, County, Zipcode
from .models import City, County, Zipcode
class GeographyTest(TestCase):

View File

@ -1,10 +1,14 @@
from __future__ import absolute_import
import os
from django.db import connections
from django.test import TestCase
from django.contrib.gis.gdal import Driver
from django.contrib.gis.geometry.test_data import TEST_DATA
from django.contrib.gis.utils.ogrinspect import ogrinspect
from models import AllOGRFields
from .models import AllOGRFields
class OGRInspectTest(TestCase):

View File

@ -1,3 +1,5 @@
from __future__ import absolute_import
import os
from copy import copy
from decimal import Decimal
@ -8,10 +10,11 @@ from django.contrib.gis.gdal import DataSource
from django.contrib.gis.tests.utils import mysql
from django.contrib.gis.utils.layermapping import LayerMapping, LayerMapError, InvalidDecimal, MissingForeignKey
from models import (
from .models import (
City, County, CountyFeat, Interstate, ICity1, ICity2, Invalid, State,
city_mapping, co_mapping, cofeat_mapping, inter_mapping)
shp_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.pardir, 'data'))
city_shp = os.path.join(shp_path, 'cities', 'cities.shp')
co_shp = os.path.join(shp_path, 'counties', 'counties.shp')

View File

@ -1,12 +1,15 @@
from __future__ import absolute_import
from datetime import date
from django.test import TestCase
from django.contrib.gis.geos import GEOSGeometry, Point, MultiPoint
from django.contrib.gis.db.models import Collect, Count, Extent, F, Union
from django.contrib.gis.geometry.backend import Geometry
from django.contrib.gis.tests.utils import mysql, oracle, no_mysql, no_oracle, no_spatialite
from django.test import TestCase
from .models import City, Location, DirectoryEntry, Parcel, Book, Author, Article
from models import City, Location, DirectoryEntry, Parcel, Book, Author, Article
class RelatedGeoModelTest(TestCase):