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
ce078ef9
Kaydet (Commit)
ce078ef9
authored
Agu 04, 2014
tarafından
Flavio Curella
Kaydeden (comit)
Claude Paroz
Eyl 12, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #19139 -- Made OpenLayersWidget follow GeoModelAdmin's modifiable attribute
Thanks Tim Graham for the review.
üst
66580fe9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
widgets.py
django/contrib/gis/admin/widgets.py
+3
-0
openlayers.html
django/contrib/gis/templates/gis/admin/openlayers.html
+2
-0
admin.py
django/contrib/gis/tests/geoadmin/admin.py
+5
-0
tests.py
django/contrib/gis/tests/geoadmin/tests.py
+22
-3
No files found.
django/contrib/gis/admin/widgets.py
Dosyayı görüntüle @
ce078ef9
...
...
@@ -22,6 +22,9 @@ class OpenLayersWidget(Textarea):
# Update the template parameters with any attributes passed in.
if
attrs
:
self
.
params
.
update
(
attrs
)
self
.
params
[
'editable'
]
=
self
.
params
[
'modifiable'
]
else
:
self
.
params
[
'editable'
]
=
True
# Defaulting the WKT value to a blank string -- this
# will be tested in the JavaScript and the appropriate
...
...
django/contrib/gis/templates/gis/admin/openlayers.html
Dosyayı görüntüle @
ce078ef9
...
...
@@ -31,7 +31,9 @@
//]]>
</script>
<div
id=
"{{ id }}_map"
{%
if
LANGUAGE_BIDI
%}
dir=
"ltr"
{%
endif
%}
></div>
{% if editable %}
<a
href=
"javascript:{{ module }}.clearFeatures()"
>
Delete all Features
</a>
{% endif %}
{% if display_wkt %}
<p>
WKT debugging window:
</p>
{% endif %}
<textarea
id=
"{{ id }}"
class=
"vWKTField required"
cols=
"150"
rows=
"10"
name=
"{{ name }}"
>
{{ wkt }}
</textarea>
<script
type=
"text/javascript"
>
{
%
block
init_function
%
}{{
module
}}.
init
();{
%
endblock
%
}
</script>
...
...
django/contrib/gis/tests/geoadmin/admin.py
0 → 100644
Dosyayı görüntüle @
ce078ef9
from
django.contrib.gis
import
admin
class
UnmodifiableAdmin
(
admin
.
OSMGeoAdmin
):
modifiable
=
False
django/contrib/gis/tests/geoadmin/tests.py
Dosyayı görüntüle @
ce078ef9
...
...
@@ -7,6 +7,7 @@ if HAS_GEOS:
from
django.contrib.gis
import
admin
from
django.contrib.gis.geos
import
Point
from
.admin
import
UnmodifiableAdmin
from
.models
import
City
...
...
@@ -20,13 +21,31 @@ class GeoAdminTest(TestCase):
self
.
assertTrue
(
any
(
geoadmin
.
openlayers_url
in
js
for
js
in
admin_js
))
def
test_olmap_OSM_rendering
(
self
):
geoadmin
=
admin
.
site
.
_registry
[
City
]
result
=
geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))(
)
.
render
(
'point'
,
Point
(
-
79.460734
,
40.18476
))
delete_all_btn
=
"""<a href="javascript:geodjango_point.clearFeatures()">Delete all Features</a>"""
original_geoadmin
=
admin
.
site
.
_registry
[
City
]
params
=
original_geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))
.
params
result
=
original_geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))(
)
.
render
(
'point'
,
Point
(
-
79.460734
,
40.18476
),
params
)
self
.
assertIn
(
"""geodjango_point.layers.base = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");"""
,
result
)
self
.
assertIn
(
delete_all_btn
,
result
)
admin
.
site
.
unregister
(
City
)
admin
.
site
.
register
(
City
,
UnmodifiableAdmin
)
try
:
geoadmin
=
admin
.
site
.
_registry
[
City
]
params
=
geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))
.
params
result
=
geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))(
)
.
render
(
'point'
,
Point
(
-
79.460734
,
40.18476
),
params
)
self
.
assertNotIn
(
delete_all_btn
,
result
)
finally
:
admin
.
site
.
unregister
(
City
)
admin
.
site
.
register
(
City
,
original_geoadmin
.
__class__
)
def
test_olmap_WMS_rendering
(
self
):
geoadmin
=
admin
.
GeoModelAdmin
(
City
,
admin
.
site
)
result
=
geoadmin
.
get_map_widget
(
City
.
_meta
.
get_field
(
'point'
))(
...
...
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