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
a7975260
Kaydet (Commit)
a7975260
authored
May 14, 2017
tarafından
Danilo Bargen
Kaydeden (comit)
Tim Graham
May 14, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28195 -- Added OSMWidget.default_zoom attribute.
üst
d4d812cb
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
2 deletions
+17
-2
widgets.py
django/contrib/gis/forms/widgets.py
+2
-1
openlayers-osm.html
django/contrib/gis/templates/gis/openlayers-osm.html
+1
-0
forms-api.txt
docs/ref/contrib/gis/forms-api.txt
+6
-0
2.0.txt
docs/releases/2.0.txt
+3
-0
test_geoforms.py
tests/gis_tests/test_geoforms.py
+5
-1
No files found.
django/contrib/gis/forms/widgets.py
Dosyayı görüntüle @
a7975260
...
...
@@ -103,10 +103,11 @@ class OSMWidget(OpenLayersWidget):
template_name
=
'gis/openlayers-osm.html'
default_lon
=
5
default_lat
=
47
default_zoom
=
12
def
__init__
(
self
,
attrs
=
None
):
super
()
.
__init__
()
for
key
in
(
'default_lon'
,
'default_lat'
):
for
key
in
(
'default_lon'
,
'default_lat'
,
'default_zoom'
):
self
.
attrs
[
key
]
=
getattr
(
self
,
key
)
if
attrs
:
self
.
attrs
.
update
(
attrs
)
django/contrib/gis/templates/gis/openlayers-osm.html
Dosyayı görüntüle @
a7975260
...
...
@@ -4,6 +4,7 @@
{% block options %}{{ block.super }}
options['default_lon'] = {{ default_lon|unlocalize }};
options['default_lat'] = {{ default_lat|unlocalize }};
options['default_zoom'] = {{ default_zoom|unlocalize }};
{% endblock %}
{% block base_layer %}
...
...
docs/ref/contrib/gis/forms-api.txt
Dosyayı görüntüle @
a7975260
...
...
@@ -185,6 +185,12 @@ Widget classes
The default center latitude and longitude are ``47`` and ``5``,
respectively, which is a location in eastern France.
.. attribute:: default_zoom
.. versionadded:: 2.0
The default map zoom is ``12``.
The :class:`OpenLayersWidget` note about JavaScript file hosting above also
applies here. See also this `FAQ answer`_ about ``https`` access to map
tiles.
...
...
docs/releases/2.0.txt
Dosyayı görüntüle @
a7975260
...
...
@@ -75,6 +75,9 @@ Minor features
* Any :class:`~django.contrib.gis.geos.GEOSGeometry` imported from GeoJSON now
has its SRID set.
* Added the :attr:`.OSMWidget.default_zoom` attribute to customize the map's
default zoom level.
:mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
tests/gis_tests/test_geoforms.py
Dosyayı görüntüle @
a7975260
...
...
@@ -328,11 +328,14 @@ class OSMWidgetTest(SimpleTestCase):
def
test_default_lat_lon
(
self
):
self
.
assertEqual
(
forms
.
OSMWidget
.
default_lon
,
5
)
self
.
assertEqual
(
forms
.
OSMWidget
.
default_lat
,
47
)
self
.
assertEqual
(
forms
.
OSMWidget
.
default_zoom
,
12
)
class
PointForm
(
forms
.
Form
):
p
=
forms
.
PointField
(
widget
=
forms
.
OSMWidget
(
attrs
=
{
'default_lon'
:
20
,
'default_lat'
:
30
'default_lon'
:
20
,
'default_lat'
:
30
,
'default_zoom'
:
17
,
}),
)
...
...
@@ -341,6 +344,7 @@ class OSMWidgetTest(SimpleTestCase):
self
.
assertIn
(
"options['default_lon'] = 20;"
,
rendered
)
self
.
assertIn
(
"options['default_lat'] = 30;"
,
rendered
)
self
.
assertIn
(
"options['default_zoom'] = 17;"
,
rendered
)
class
GeometryWidgetTests
(
SimpleTestCase
):
...
...
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