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
4dcfacb5
Kaydet (Commit)
4dcfacb5
authored
Eyl 18, 2014
tarafından
Claude Paroz
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed string length check in LayerMapping
üst
7fc13178
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
4 deletions
+12
-4
models.py
django/contrib/gis/tests/layermap/models.py
+1
-0
tests.py
django/contrib/gis/tests/layermap/tests.py
+8
-1
layermapping.py
django/contrib/gis/utils/layermapping.py
+3
-3
No files found.
django/contrib/gis/tests/layermap/models.py
Dosyayı görüntüle @
4dcfacb5
...
...
@@ -31,6 +31,7 @@ class CountyFeat(NamedModel):
class
City
(
NamedModel
):
name_txt
=
models
.
TextField
(
default
=
''
)
name_short
=
models
.
CharField
(
max_length
=
5
)
population
=
models
.
IntegerField
()
density
=
models
.
DecimalField
(
max_digits
=
7
,
decimal_places
=
1
)
dt
=
models
.
DateField
()
...
...
django/contrib/gis/tests/layermap/tests.py
Dosyayı görüntüle @
4dcfacb5
...
...
@@ -15,7 +15,7 @@ from django.utils._os import upath
if
HAS_GDAL
:
from
django.contrib.gis.utils.layermapping
import
(
LayerMapping
,
LayerMapError
,
InvalidDecimal
,
MissingForeignKey
)
LayerMapError
,
InvalidDecimal
,
InvalidString
,
MissingForeignKey
)
from
django.contrib.gis.gdal
import
DataSource
from
.models
import
(
...
...
@@ -287,6 +287,13 @@ class LayerMapTest(TestCase):
source_srs
=
4326
)
lm
.
save
(
silent
=
True
)
def
test_charfield_too_short
(
self
):
mapping
=
copy
(
city_mapping
)
mapping
[
'name_short'
]
=
'Name'
lm
=
LayerMapping
(
City
,
city_shp
,
mapping
)
with
self
.
assertRaises
(
InvalidString
):
lm
.
save
(
silent
=
True
,
strict
=
True
)
def
test_textfield
(
self
):
"Tests that String content fits also in a TextField"
mapping
=
copy
(
city_mapping
)
...
...
django/contrib/gis/utils/layermapping.py
Dosyayı görüntüle @
4dcfacb5
...
...
@@ -346,9 +346,9 @@ class LayerMapping(object):
val
=
force_text
(
ogr_field
.
value
,
self
.
encoding
)
else
:
val
=
ogr_field
.
value
if
model_field
.
max_length
and
len
(
val
)
>
model_field
.
max_length
:
raise
InvalidString
(
'
%
s model field maximum string length is
%
s, given
%
s characters.'
%
(
model_field
.
name
,
model_field
.
max_length
,
len
(
val
)))
if
model_field
.
max_length
and
len
(
val
)
>
model_field
.
max_length
:
raise
InvalidString
(
'
%
s model field maximum string length is
%
s, given
%
s characters.'
%
(
model_field
.
name
,
model_field
.
max_length
,
len
(
val
)))
elif
isinstance
(
ogr_field
,
OFTReal
)
and
isinstance
(
model_field
,
models
.
DecimalField
):
try
:
# Creating an instance of the Decimal value to use.
...
...
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