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
fce78271
Kaydet (Commit)
fce78271
authored
Nis 10, 2017
tarafından
Tim Graham
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #28047 -- Fixed QuerySet.filter() crash when it uses the name of a OneToOneField pk.
Regression in
1bc249c2
.
üst
a19b373d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
1 deletion
+9
-1
related_lookups.py
django/db/models/fields/related_lookups.py
+2
-1
1.11.1.txt
docs/releases/1.11.1.txt
+3
-0
tests.py
tests/one_to_one/tests.py
+4
-0
No files found.
django/db/models/fields/related_lookups.py
Dosyayı görüntüle @
fce78271
...
...
@@ -83,7 +83,8 @@ class RelatedIn(In):
else
:
if
getattr
(
self
.
rhs
,
'_forced_pk'
,
False
):
self
.
rhs
.
clear_select_clause
()
if
getattr
(
self
.
lhs
.
output_field
,
'primary_key'
,
False
):
if
(
getattr
(
self
.
lhs
.
output_field
,
'primary_key'
,
False
)
and
self
.
lhs
.
output_field
.
model
==
self
.
rhs
.
model
):
# A case like Restaurant.objects.filter(place__in=restaurant_qs),
# where place is a OneToOneField and the primary key of
# Restaurant.
...
...
docs/releases/1.11.1.txt
Dosyayı görüntüle @
fce78271
...
...
@@ -18,3 +18,6 @@ Bugfixes
* Fixed a crash when using a two-tuple in ``EmailMessage``’s ``attachments``
argument (:ticket:`28042`).
* Fixed ``QuerySet.filter()`` crash when it references the name of a
``OneToOneField`` primary key (:ticket:`28047`).
tests/one_to_one/tests.py
Dosyayı görüntüle @
fce78271
...
...
@@ -479,6 +479,10 @@ class OneToOneTests(TestCase):
pk__in
=
Restaurant
.
objects
.
filter
(
place__id
=
r
.
place
.
pk
)
)
self
.
assertSequenceEqual
(
q2
,
[
r
])
q3
=
Restaurant
.
objects
.
filter
(
place__in
=
Place
.
objects
.
all
())
self
.
assertSequenceEqual
(
q3
,
[
r
])
q4
=
Restaurant
.
objects
.
filter
(
place__in
=
Place
.
objects
.
filter
(
id
=
r
.
pk
))
self
.
assertSequenceEqual
(
q4
,
[
r
])
def
test_rel_pk_exact
(
self
):
r
=
Restaurant
.
objects
.
first
()
...
...
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