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:
parent
544a8372fd
commit
66210cbc70
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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)),
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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')
|
||||
|
@ -29,10 +31,10 @@ city_data = (
|
|||
# Reference mapping of city name to its altitude (Z value).
|
||||
city_dict = dict((name, coords) for name, coords in city_data)
|
||||
|
||||
# 3D freeway data derived from the National Elevation Dataset:
|
||||
# 3D freeway data derived from the National Elevation Dataset:
|
||||
# http://seamless.usgs.gov/products/9arc.php
|
||||
interstate_data = (
|
||||
('I-45',
|
||||
('I-45',
|
||||
'LINESTRING(-95.3708481 29.7765870 11.339,-95.3694580 29.7787980 4.536,-95.3690305 29.7797359 9.762,-95.3691886 29.7812450 12.448,-95.3696447 29.7850144 10.457,-95.3702511 29.7868518 9.418,-95.3706724 29.7881286 14.858,-95.3711632 29.7896157 15.386,-95.3714525 29.7936267 13.168,-95.3717848 29.7955007 15.104,-95.3717719 29.7969804 16.516,-95.3717305 29.7982117 13.923,-95.3717254 29.8000778 14.385,-95.3719875 29.8013539 15.160,-95.3720575 29.8026785 15.544,-95.3721321 29.8040912 14.975,-95.3722074 29.8050998 15.688,-95.3722779 29.8060430 16.099,-95.3733818 29.8076750 15.197,-95.3741563 29.8103686 17.268,-95.3749458 29.8129927 19.857,-95.3763564 29.8144557 15.435)',
|
||||
( 11.339, 4.536, 9.762, 12.448, 10.457, 9.418, 14.858,
|
||||
15.386, 13.168, 15.104, 16.516, 13.923, 14.385, 15.16 ,
|
||||
|
@ -48,13 +50,13 @@ bbox_wkt = 'POLYGON((941527.97 4225693.20,962596.48 4226349.75,963152.57 4209023
|
|||
bbox_z = (21.71, 13.21, 9.12, 16.40, 21.71)
|
||||
def gen_bbox():
|
||||
bbox_2d = GEOSGeometry(bbox_wkt, srid=32140)
|
||||
bbox_3d = Polygon(tuple((x, y, z) for (x, y), z in zip(bbox_2d[0].coords, bbox_z)), srid=32140)
|
||||
bbox_3d = Polygon(tuple((x, y, z) for (x, y), z in zip(bbox_2d[0].coords, bbox_z)), srid=32140)
|
||||
return bbox_2d, bbox_3d
|
||||
|
||||
class Geo3DTest(TestCase):
|
||||
"""
|
||||
Only a subset of the PostGIS routines are 3D-enabled, and this TestCase
|
||||
tries to test the features that can handle 3D and that are also
|
||||
tries to test the features that can handle 3D and that are also
|
||||
available within GeoDjango. For more information, see the PostGIS docs
|
||||
on the routines that support 3D:
|
||||
|
||||
|
@ -64,7 +66,7 @@ class Geo3DTest(TestCase):
|
|||
def test01_3d(self):
|
||||
"Test the creation of 3D models."
|
||||
# 3D models for the rest of the tests will be populated in here.
|
||||
# For each 3D data set create model (and 2D version if necessary),
|
||||
# For each 3D data set create model (and 2D version if necessary),
|
||||
# retrieve, and assert geometry is in 3D and contains the expected
|
||||
# 3D values.
|
||||
for name, pnt_data in city_data:
|
||||
|
@ -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'}
|
||||
|
@ -120,7 +122,7 @@ class Geo3DTest(TestCase):
|
|||
# in the 3D model -- thus, a LayerMapError is raised.
|
||||
self.assertRaises(LayerMapError, LayerMapping,
|
||||
Point3D, city_file, point_mapping, transform=False)
|
||||
|
||||
|
||||
# 3D model should take 3D data just fine.
|
||||
lm = LayerMapping(Point3D, vrt_file, point_mapping, transform=False)
|
||||
lm.save()
|
||||
|
@ -190,7 +192,7 @@ class Geo3DTest(TestCase):
|
|||
"Testing GeoQuerySet.length() on 3D fields."
|
||||
# ST_Length_Spheroid Z-aware, and thus does not need to use
|
||||
# a separate function internally.
|
||||
# `SELECT ST_Length_Spheroid(line, 'SPHEROID["GRS 1980",6378137,298.257222101]')
|
||||
# `SELECT ST_Length_Spheroid(line, 'SPHEROID["GRS 1980",6378137,298.257222101]')
|
||||
# FROM geo3d_interstate[2d|3d];`
|
||||
tol = 3
|
||||
ref_length_2d = 4368.1721949481
|
||||
|
@ -214,7 +216,7 @@ class Geo3DTest(TestCase):
|
|||
self.assertAlmostEqual(ref_length_3d,
|
||||
InterstateProj3D.objects.length().get(name='I-45').length.m,
|
||||
tol)
|
||||
|
||||
|
||||
def test06_scale(self):
|
||||
"Testing GeoQuerySet.scale() on Z values."
|
||||
# Mapping of City name to reference Z values.
|
||||
|
|
|
@ -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'
|
||||
|
@ -9,4 +13,4 @@ class GeoAdminTest(TestCase):
|
|||
geoadmin = admin.site._registry[City]
|
||||
admin_js = geoadmin.media.render_js()
|
||||
self.assertTrue(any([geoadmin.openlayers_url in js for js in admin_js]))
|
||||
|
||||
|
||||
|
|
|
@ -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/'
|
||||
|
|
|
@ -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]),
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}),
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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):
|
||||
|
||||
|
|
Loading…
Reference in New Issue