Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
b27547f9
Kaydet (Commit)
b27547f9
authored
Agu 10, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed deprecated GeoManager from inspectdb/ogrinspect output.
refs
ea27e26b
üst
f2e4c7ac
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
23 deletions
+2
-23
inspectdb.py
django/contrib/gis/management/commands/inspectdb.py
+0
-15
ogrinspect.py
django/contrib/gis/utils/ogrinspect.py
+0
-1
tests.py
tests/gis_tests/inspectapp/tests.py
+2
-7
No files found.
django/contrib/gis/management/commands/inspectdb.py
Dosyayı görüntüle @
b27547f9
...
@@ -4,7 +4,6 @@ from django.core.management.commands.inspectdb import \
...
@@ -4,7 +4,6 @@ from django.core.management.commands.inspectdb import \
class
Command
(
InspectDBCommand
):
class
Command
(
InspectDBCommand
):
db_module
=
'django.contrib.gis.db'
db_module
=
'django.contrib.gis.db'
gis_tables
=
{}
def
get_field_type
(
self
,
connection
,
table_name
,
row
):
def
get_field_type
(
self
,
connection
,
table_name
,
row
):
field_type
,
field_params
,
field_notes
=
super
(
Command
,
self
)
.
get_field_type
(
connection
,
table_name
,
row
)
field_type
,
field_params
,
field_notes
=
super
(
Command
,
self
)
.
get_field_type
(
connection
,
table_name
,
row
)
...
@@ -14,18 +13,4 @@ class Command(InspectDBCommand):
...
@@ -14,18 +13,4 @@ class Command(InspectDBCommand):
# from the `get_geometry_type` routine for the spatial backend.
# from the `get_geometry_type` routine for the spatial backend.
field_type
,
geo_params
=
connection
.
introspection
.
get_geometry_type
(
table_name
,
geo_col
)
field_type
,
geo_params
=
connection
.
introspection
.
get_geometry_type
(
table_name
,
geo_col
)
field_params
.
update
(
geo_params
)
field_params
.
update
(
geo_params
)
# Adding the table name and column to the `gis_tables` dictionary, this
# allows us to track which tables need a GeoManager.
if
table_name
in
self
.
gis_tables
:
self
.
gis_tables
[
table_name
]
.
append
(
geo_col
)
else
:
self
.
gis_tables
[
table_name
]
=
[
geo_col
]
return
field_type
,
field_params
,
field_notes
return
field_type
,
field_params
,
field_notes
def
get_meta
(
self
,
table_name
,
constraints
):
meta_lines
=
super
(
Command
,
self
)
.
get_meta
(
table_name
,
constraints
)
if
table_name
in
self
.
gis_tables
:
# If the table is a geographic one, then we need make
# GeoManager the default manager for the model.
meta_lines
.
insert
(
0
,
' objects = models.GeoManager()'
)
return
meta_lines
django/contrib/gis/utils/ogrinspect.py
Dosyayı görüntüle @
b27547f9
...
@@ -232,7 +232,6 @@ def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non
...
@@ -232,7 +232,6 @@ def _ogrinspect(data_source, model_name, geom_name='geom', layer_key=0, srid=Non
srid_str
=
'srid=
%
s'
%
srid
srid_str
=
'srid=
%
s'
%
srid
yield
'
%
s = models.
%
s(
%
s)'
%
(
geom_name
,
geom_field
,
srid_str
)
yield
'
%
s = models.
%
s(
%
s)'
%
(
geom_name
,
geom_field
,
srid_str
)
yield
' objects = models.GeoManager()'
if
name_field
:
if
name_field
:
yield
''
yield
''
...
...
tests/gis_tests/inspectapp/tests.py
Dosyayı görüntüle @
b27547f9
...
@@ -40,7 +40,6 @@ class InspectDbTests(TestCase):
...
@@ -40,7 +40,6 @@ class InspectDbTests(TestCase):
else
:
else
:
self
.
assertIn
(
'geom = models.GeometryField('
,
output
)
self
.
assertIn
(
'geom = models.GeometryField('
,
output
)
self
.
assertIn
(
'point = models.GeometryField('
,
output
)
self
.
assertIn
(
'point = models.GeometryField('
,
output
)
self
.
assertIn
(
'objects = models.GeoManager()'
,
output
)
@skipUnlessDBFeature
(
"supports_3d_storage"
)
@skipUnlessDBFeature
(
"supports_3d_storage"
)
def
test_3d_columns
(
self
):
def
test_3d_columns
(
self
):
...
@@ -59,7 +58,6 @@ class InspectDbTests(TestCase):
...
@@ -59,7 +58,6 @@ class InspectDbTests(TestCase):
self
.
assertIn
(
'point = models.GeometryField('
,
output
)
self
.
assertIn
(
'point = models.GeometryField('
,
output
)
self
.
assertIn
(
'line = models.GeometryField('
,
output
)
self
.
assertIn
(
'line = models.GeometryField('
,
output
)
self
.
assertIn
(
'poly = models.GeometryField('
,
output
)
self
.
assertIn
(
'poly = models.GeometryField('
,
output
)
self
.
assertIn
(
'objects = models.GeoManager()'
,
output
)
@skipUnless
(
HAS_GDAL
,
"OGRInspectTest needs GDAL support"
)
@skipUnless
(
HAS_GDAL
,
"OGRInspectTest needs GDAL support"
)
...
@@ -82,7 +80,6 @@ class OGRInspectTest(TestCase):
...
@@ -82,7 +80,6 @@ class OGRInspectTest(TestCase):
' int = models.{}()'
.
format
(
'BigIntegerField'
if
GDAL_VERSION
>=
(
2
,
0
)
else
'FloatField'
),
' int = models.{}()'
.
format
(
'BigIntegerField'
if
GDAL_VERSION
>=
(
2
,
0
)
else
'FloatField'
),
' str = models.CharField(max_length=80)'
,
' str = models.CharField(max_length=80)'
,
' geom = models.PolygonField(srid=-1)'
,
' geom = models.PolygonField(srid=-1)'
,
' objects = models.GeoManager()'
,
]
]
self
.
assertEqual
(
model_def
,
'
\n
'
.
join
(
expected
))
self
.
assertEqual
(
model_def
,
'
\n
'
.
join
(
expected
))
...
@@ -110,7 +107,6 @@ class OGRInspectTest(TestCase):
...
@@ -110,7 +107,6 @@ class OGRInspectTest(TestCase):
' density = models.FloatField()'
,
' density = models.FloatField()'
,
' created = models.DateField()'
,
' created = models.DateField()'
,
' geom = models.PointField(srid=-1)'
,
' geom = models.PointField(srid=-1)'
,
' objects = models.GeoManager()'
,
]
]
self
.
assertEqual
(
model_def
,
'
\n
'
.
join
(
expected
))
self
.
assertEqual
(
model_def
,
'
\n
'
.
join
(
expected
))
...
@@ -147,9 +143,8 @@ class OGRInspectTest(TestCase):
...
@@ -147,9 +143,8 @@ class OGRInspectTest(TestCase):
self
.
assertIn
(
' f_char = models.CharField(max_length=10)'
,
model_def
)
self
.
assertIn
(
' f_char = models.CharField(max_length=10)'
,
model_def
)
self
.
assertIn
(
' f_date = models.DateField()'
,
model_def
)
self
.
assertIn
(
' f_date = models.DateField()'
,
model_def
)
self
.
assertIsNotNone
(
re
.
search
(
# Some backends may have srid=-1
r' geom = models.PolygonField\(([^\)])*\)\n'
# Some backends may have srid=-1
self
.
assertIsNotNone
(
re
.
search
(
r' geom = models.PolygonField\(([^\)])*\)'
,
model_def
))
r' objects = models.GeoManager\(\)'
,
model_def
))
def
test_management_command
(
self
):
def
test_management_command
(
self
):
shp_file
=
os
.
path
.
join
(
TEST_DATA
,
'cities'
,
'cities.shp'
)
shp_file
=
os
.
path
.
join
(
TEST_DATA
,
'cities'
,
'cities.shp'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment