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
273dc550
Kaydet (Commit)
273dc550
authored
Haz 26, 2013
tarafından
Andrew Clark
Kaydeden (comit)
Tim Graham
Haz 26, 2013
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #20462 -- null/non-string regex lookups are now consistent
Thanks to noirbizarre for the report and initial patch.
üst
c6862d57
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
2 deletions
+19
-2
AUTHORS
AUTHORS
+2
-0
operations.py
django/db/backends/postgresql_psycopg2/operations.py
+1
-1
base.py
django/db/backends/sqlite3/base.py
+1
-1
tests.py
tests/lookup/tests.py
+15
-0
No files found.
AUTHORS
Dosyayı görüntüle @
273dc550
...
...
@@ -152,6 +152,7 @@ answer newbie questions, and generally made Django that much better:
Antonis Christofides <anthony@itia.ntua.gr>
Michal Chruszcz <troll@pld-linux.org>
Can Burak Çilingir <canburak@cs.bilgi.edu.tr>
Andrew Clark <amclark7@gmail.com>
Ian Clelland <clelland@gmail.com>
Travis Cline <travis.cline@gmail.com>
Russell Cloran <russell@rucus.net>
...
...
@@ -273,6 +274,7 @@ answer newbie questions, and generally made Django that much better:
Brian Harring <ferringb@gmail.com>
Brant Harris
Ronny Haryanto <http://ronny.haryan.to/>
Axel Haustant <noirbizarre@gmail.com>
Hawkeye
Kent Hauser <kent@khauser.net>
Joe Heck <http://www.rhonabwy.com/wp/>
...
...
django/db/backends/postgresql_psycopg2/operations.py
Dosyayı görüntüle @
273dc550
...
...
@@ -69,7 +69,7 @@ class DatabaseOperations(BaseDatabaseOperations):
# Cast text lookups to text to allow things like filter(x__contains=4)
if
lookup_type
in
(
'iexact'
,
'contains'
,
'icontains'
,
'startswith'
,
'istartswith'
,
'endswith'
,
'iendswith'
):
'istartswith'
,
'endswith'
,
'iendswith'
,
'regex'
,
'iregex'
):
lookup
=
"
%
s::text"
# Use UPPER(x) for case-insensitive lookups; it's faster.
...
...
django/db/backends/sqlite3/base.py
Dosyayı görüntüle @
273dc550
...
...
@@ -522,4 +522,4 @@ def _sqlite_format_dtdelta(dt, conn, days, secs, usecs):
return
str
(
dt
)
def
_sqlite_regexp
(
re_pattern
,
re_string
):
return
bool
(
re
.
search
(
re_pattern
,
re_string
))
return
bool
(
re
.
search
(
re_pattern
,
str
(
re_string
)))
if
re_string
is
not
None
else
False
tests/lookup/tests.py
Dosyayı görüntüle @
273dc550
...
...
@@ -610,6 +610,21 @@ class LookupTests(TestCase):
self
.
assertQuerysetEqual
(
Article
.
objects
.
filter
(
headline__regex
=
r'b(.).*b\1'
),
[
'<Article: barfoobaz>'
,
'<Article: bazbaRFOO>'
,
'<Article: foobarbaz>'
])
def
test_regex_null
(
self
):
"""
Ensure that a regex lookup does not fail on null/None values
"""
Season
.
objects
.
create
(
year
=
2012
,
gt
=
None
)
self
.
assertQuerysetEqual
(
Season
.
objects
.
filter
(
gt__regex
=
r'^$'
),
[])
def
test_regex_non_string
(
self
):
"""
Ensure that a regex lookup does not fail on non-string fields
"""
Season
.
objects
.
create
(
year
=
2013
,
gt
=
444
)
self
.
assertQuerysetEqual
(
Season
.
objects
.
filter
(
gt__regex
=
r'^444$'
),
[
'<Season: 2013>'
])
def
test_nonfield_lookups
(
self
):
"""
Ensure that a lookup query containing non-fields raises the proper
...
...
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