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
5d240b07
Kaydet (Commit)
5d240b07
authored
Şub 19, 2016
tarafından
Simon Charette
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #17001 -- Added a test for custom prefetch related queryset on generic relations.
üst
1d17bb4f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
tests.py
tests/prefetch_related/tests.py
+13
-0
No files found.
tests/prefetch_related/tests.py
Dosyayı görüntüle @
5d240b07
...
...
@@ -836,6 +836,19 @@ class GenericRelationTests(TestCase):
self
.
assertEqual
(
sorted
([
i
.
tag
for
i
in
bookmark
.
tags
.
all
()]),
[
"django"
,
"python"
])
self
.
assertEqual
([
i
.
tag
for
i
in
bookmark
.
favorite_tags
.
all
()],
[
"python"
])
def
test_custom_queryset
(
self
):
bookmark
=
Bookmark
.
objects
.
create
(
url
=
'http://www.djangoproject.com/'
)
django_tag
=
TaggedItem
.
objects
.
create
(
content_object
=
bookmark
,
tag
=
'django'
)
TaggedItem
.
objects
.
create
(
content_object
=
bookmark
,
tag
=
'python'
)
with
self
.
assertNumQueries
(
2
):
bookmark
=
Bookmark
.
objects
.
prefetch_related
(
Prefetch
(
'tags'
,
TaggedItem
.
objects
.
filter
(
tag
=
'django'
)),
)
.
get
()
with
self
.
assertNumQueries
(
0
):
self
.
assertEqual
(
list
(
bookmark
.
tags
.
all
()),
[
django_tag
])
class
MultiTableInheritanceTest
(
TestCase
):
...
...
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