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
30e57038
Kaydet (Commit)
30e57038
authored
May 15, 2015
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.8.x] Fixed #24802 -- Delayed GDAL check for OSMGeoAdmin
Backport of
a37dcfd0
from master
üst
f1993259
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
24 deletions
+25
-24
__init__.py
django/contrib/gis/admin/__init__.py
+6
-13
options.py
django/contrib/gis/admin/options.py
+16
-10
models.py
tests/gis_tests/geoadmin/models.py
+3
-1
No files found.
django/contrib/gis/admin/__init__.py
Dosyayı görüntüle @
30e57038
# Getting the normal admin routines, classes, and `site` instance.
# Getting the normal admin routines, classes, and `site` instance.
from
django.contrib.admin
import
(
# NOQA: flake8 detects only the last __all__
from
django.contrib.admin
import
(
autodiscover
,
site
,
AdminSite
,
ModelAdmin
,
StackedInline
,
TabularInline
,
autodiscover
,
site
,
AdminSite
,
ModelAdmin
,
StackedInline
,
TabularInline
,
HORIZONTAL
,
VERTICAL
,
HORIZONTAL
,
VERTICAL
,
)
)
# Geographic admin options classes and widgets.
# Geographic admin options classes and widgets.
from
django.contrib.gis.admin.options
import
GeoModelAdmin
# NOQA
from
django.contrib.gis.admin.options
import
GeoModelAdmin
,
OSMGeoAdmin
from
django.contrib.gis.admin.widgets
import
OpenLayersWidget
# NOQA
from
django.contrib.gis.admin.widgets
import
OpenLayersWidget
__all__
=
[
__all__
=
[
"autodiscover"
,
"site"
,
"AdminSite"
,
"ModelAdmin"
,
"StackedInline"
,
'autodiscover'
,
'site'
,
'AdminSite'
,
'ModelAdmin'
,
'StackedInline'
,
"TabularInline"
,
"HORIZONTAL"
,
"VERTICAL"
,
'TabularInline'
,
'HORIZONTAL'
,
'VERTICAL'
,
'GeoModelAdmin'
,
'OSMGeoAdmin'
,
"GeoModelAdmin"
,
"OpenLayersWidget"
,
"HAS_OSM"
,
'OpenLayersWidget'
,
]
]
try
:
from
django.contrib.gis.admin.options
import
OSMGeoAdmin
HAS_OSM
=
True
__all__
+=
[
'OSMGeoAdmin'
]
except
ImportError
:
HAS_OSM
=
False
django/contrib/gis/admin/options.py
Dosyayı görüntüle @
30e57038
...
@@ -2,6 +2,9 @@ from django.contrib.admin import ModelAdmin
...
@@ -2,6 +2,9 @@ from django.contrib.admin import ModelAdmin
from
django.contrib.gis.admin.widgets
import
OpenLayersWidget
from
django.contrib.gis.admin.widgets
import
OpenLayersWidget
from
django.contrib.gis.db
import
models
from
django.contrib.gis.db
import
models
from
django.contrib.gis.gdal
import
HAS_GDAL
,
OGRGeomType
from
django.contrib.gis.gdal
import
HAS_GDAL
,
OGRGeomType
from
django.core.exceptions
import
ImproperlyConfigured
spherical_mercator_srid
=
3857
class
GeoModelAdmin
(
ModelAdmin
):
class
GeoModelAdmin
(
ModelAdmin
):
...
@@ -123,14 +126,17 @@ class GeoModelAdmin(ModelAdmin):
...
@@ -123,14 +126,17 @@ class GeoModelAdmin(ModelAdmin):
}
}
return
OLMap
return
OLMap
if
HAS_GDAL
:
spherical_mercator_srid
=
3857
class
OSMGeoAdmin
(
GeoModelAdmin
):
class
OSMGeoAdmin
(
GeoModelAdmin
):
map_template
=
'gis/admin/osm.html'
map_template
=
'gis/admin/osm.html'
num_zoom
=
20
num_zoom
=
20
map_srid
=
spherical_mercator_srid
map_srid
=
spherical_mercator_srid
max_extent
=
'-20037508,-20037508,20037508,20037508'
max_extent
=
'-20037508,-20037508,20037508,20037508'
max_resolution
=
'156543.0339'
max_resolution
=
'156543.0339'
point_zoom
=
num_zoom
-
6
point_zoom
=
num_zoom
-
6
units
=
'm'
units
=
'm'
def
__init__
(
self
,
*
args
):
if
not
HAS_GDAL
:
raise
ImproperlyConfigured
(
"OSMGeoAdmin is not usable without GDAL libs installed"
)
super
(
OSMGeoAdmin
,
self
)
.
__init__
(
*
args
)
tests/gis_tests/geoadmin/models.py
Dosyayı görüntüle @
30e57038
from
django.contrib.gis
import
admin
from
django.contrib.gis
import
admin
from
django.contrib.gis.db
import
models
from
django.contrib.gis.db
import
models
from
django.contrib.gis.gdal
import
HAS_GDAL
from
django.utils.encoding
import
python_2_unicode_compatible
from
django.utils.encoding
import
python_2_unicode_compatible
...
@@ -16,4 +17,5 @@ class City(models.Model):
...
@@ -16,4 +17,5 @@ class City(models.Model):
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
name
return
self
.
name
admin
.
site
.
register
(
City
,
admin
.
OSMGeoAdmin
)
if
HAS_GDAL
:
admin
.
site
.
register
(
City
,
admin
.
OSMGeoAdmin
)
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