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
75aeebeb
Kaydet (Commit)
75aeebeb
authored
Nis 29, 2017
tarafından
Dylan Verheul
Kaydeden (comit)
Tim Graham
May 01, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28105 -- Fixed crash in BaseGeometryWidget.get_context() when overriding existing attrs.
üst
1ebd2950
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
9 deletions
+20
-9
widgets.py
django/contrib/gis/forms/widgets.py
+10
-9
1.11.1.txt
docs/releases/1.11.1.txt
+3
-0
test_geoforms.py
tests/gis_tests/test_geoforms.py
+7
-0
No files found.
django/contrib/gis/forms/widgets.py
Dosyayı görüntüle @
75aeebeb
...
...
@@ -63,15 +63,16 @@ class BaseGeometryWidget(Widget):
if
attrs
is
None
:
attrs
=
{}
context
.
update
(
self
.
build_attrs
(
self
.
attrs
,
dict
(
name
=
name
,
module
=
'geodjango_
%
s'
%
name
.
replace
(
'-'
,
'_'
),
# JS-safe
serialized
=
self
.
serialize
(
value
),
geom_type
=
gdal
.
OGRGeomType
(
self
.
attrs
[
'geom_type'
]),
STATIC_URL
=
settings
.
STATIC_URL
,
LANGUAGE_BIDI
=
translation
.
get_language_bidi
(),
**
attrs
)))
build_attrs_kwargs
=
{
'name'
:
name
,
'module'
:
'geodjango_
%
s'
%
name
.
replace
(
'-'
,
'_'
),
# JS-safe
'serialized'
:
self
.
serialize
(
value
),
'geom_type'
:
gdal
.
OGRGeomType
(
self
.
attrs
[
'geom_type'
]),
'STATIC_URL'
:
settings
.
STATIC_URL
,
'LANGUAGE_BIDI'
:
translation
.
get_language_bidi
(),
}
build_attrs_kwargs
.
update
(
attrs
)
context
.
update
(
self
.
build_attrs
(
self
.
attrs
,
build_attrs_kwargs
))
return
context
...
...
docs/releases/1.11.1.txt
Dosyayı görüntüle @
75aeebeb
...
...
@@ -66,3 +66,6 @@ Bugfixes
* Updated the ``contrib.postgres`` ``SplitArrayWidget`` to use template-based
widget rendering (:ticket:`28040`).
* Fixed crash in ``BaseGeometryWidget.get_context()`` when overriding existing
``attrs`` (:ticket:`28105`).
tests/gis_tests/test_geoforms.py
Dosyayı görüntüle @
75aeebeb
import
re
from
django.contrib.gis
import
forms
from
django.contrib.gis.forms
import
BaseGeometryWidget
from
django.contrib.gis.geos
import
GEOSGeometry
from
django.forms
import
ValidationError
from
django.test
import
SimpleTestCase
,
override_settings
,
skipUnlessDBFeature
...
...
@@ -353,6 +354,12 @@ class OSMWidgetTest(SimpleTestCase):
@skipUnlessDBFeature
(
"gis_enabled"
)
class
GeometryWidgetTests
(
SimpleTestCase
):
def
test_get_context_attrs
(
self
):
"""The Widget.get_context() attrs argument overrides self.attrs."""
widget
=
BaseGeometryWidget
(
attrs
=
{
'geom_type'
:
'POINT'
})
context
=
widget
.
get_context
(
'point'
,
None
,
attrs
=
{
'geom_type'
:
'POINT2'
})
self
.
assertEqual
(
context
[
'geom_type'
],
'POINT2'
)
def
test_subwidgets
(
self
):
widget
=
forms
.
BaseGeometryWidget
()
self
.
assertEqual
(
...
...
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