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
3f795384
Kaydet (Commit)
3f795384
authored
Tem 19, 2017
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Tem 19, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed typo in DistanceLookupBase.process_rhs() error message.
üst
196da41e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
7 deletions
+9
-7
lookups.py
django/contrib/gis/db/models/lookups.py
+1
-1
tests.py
tests/gis_tests/distapp/tests.py
+8
-6
No files found.
django/contrib/gis/db/models/lookups.py
Dosyayı görüntüle @
3f795384
...
@@ -306,7 +306,7 @@ class DistanceLookupBase(GISLookup):
...
@@ -306,7 +306,7 @@ class DistanceLookupBase(GISLookup):
if
not
isinstance
(
self
.
rhs
,
(
tuple
,
list
))
or
not
2
<=
len
(
self
.
rhs
)
<=
4
:
if
not
isinstance
(
self
.
rhs
,
(
tuple
,
list
))
or
not
2
<=
len
(
self
.
rhs
)
<=
4
:
raise
ValueError
(
"2, 3, or 4-element tuple required for '
%
s' lookup."
%
self
.
lookup_name
)
raise
ValueError
(
"2, 3, or 4-element tuple required for '
%
s' lookup."
%
self
.
lookup_name
)
elif
len
(
self
.
rhs
)
==
4
and
not
self
.
rhs
[
3
]
==
'spheroid'
:
elif
len
(
self
.
rhs
)
==
4
and
not
self
.
rhs
[
3
]
==
'spheroid'
:
raise
ValueError
(
"For 4-element tuples the last argument must be the 'speroid' directive."
)
raise
ValueError
(
"For 4-element tuples the last argument must be the 'sp
h
eroid' directive."
)
# Check if the second parameter is a band index.
# Check if the second parameter is a band index.
if
len
(
self
.
rhs
)
>
2
and
not
self
.
rhs
[
2
]
==
'spheroid'
:
if
len
(
self
.
rhs
)
>
2
and
not
self
.
rhs
[
2
]
==
'spheroid'
:
...
...
tests/gis_tests/distapp/tests.py
Dosyayı görüntüle @
3f795384
...
@@ -140,15 +140,17 @@ class DistanceTest(TestCase):
...
@@ -140,15 +140,17 @@ class DistanceTest(TestCase):
expected_cities
.
pop
(
0
)
expected_cities
.
pop
(
0
)
self
.
assertEqual
(
expected_cities
,
self
.
get_names
(
dist_qs
))
self
.
assertEqual
(
expected_cities
,
self
.
get_names
(
dist_qs
))
# Too many params (4 in this case) should raise a ValueError.
msg
=
"2, 3, or 4-element tuple required for 'distance_lte' lookup."
queryset
=
AustraliaCity
.
objects
.
filter
(
point__distance_lte
=
(
'POINT(5 23)'
,
D
(
km
=
100
),
'spheroid'
,
'4'
))
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
# Too many params.
with
self
.
assertRaises
(
ValueError
):
len
(
AustraliaCity
.
objects
.
filter
(
point__distance_lte
=
(
'POINT(5 23)'
,
D
(
km
=
100
),
'spheroid'
,
'4'
,
None
)))
len
(
queryset
)
# Not enough params should raise a ValueError.
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
# Too few params.
with
self
.
assertRaises
(
ValueError
):
len
(
AustraliaCity
.
objects
.
filter
(
point__distance_lte
=
(
'POINT(5 23)'
,)))
len
(
AustraliaCity
.
objects
.
filter
(
point__distance_lte
=
(
'POINT(5 23)'
,)))
msg
=
"For 4-element tuples the last argument must be the 'spheroid' directive."
with
self
.
assertRaisesMessage
(
ValueError
,
msg
):
len
(
AustraliaCity
.
objects
.
filter
(
point__distance_lte
=
(
'POINT(5 23)'
,
D
(
km
=
100
),
'spheroid'
,
'4'
)))
# Getting all cities w/in 550 miles of Hobart.
# Getting all cities w/in 550 miles of Hobart.
hobart
=
AustraliaCity
.
objects
.
get
(
name
=
'Hobart'
)
hobart
=
AustraliaCity
.
objects
.
get
(
name
=
'Hobart'
)
qs
=
AustraliaCity
.
objects
.
exclude
(
name
=
'Hobart'
)
.
filter
(
point__distance_lte
=
(
hobart
.
point
,
D
(
mi
=
550
)))
qs
=
AustraliaCity
.
objects
.
exclude
(
name
=
'Hobart'
)
.
filter
(
point__distance_lte
=
(
hobart
.
point
,
D
(
mi
=
550
)))
...
...
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