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
ce1dd6a7
Kaydet (Commit)
ce1dd6a7
authored
May 28, 2014
tarafından
Víðir Valberg Guðmundsson
Kaydeden (comit)
Tim Graham
May 29, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[1.7.x] Adding test to fix of duplicate _order fields (#22720)
Backport of
bf9953cf
from master
üst
0ee27d5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
tests.py
tests/order_with_respect_to/tests.py
+21
-0
No files found.
tests/order_with_respect_to/tests.py
Dosyayı görüntüle @
ce1dd6a7
...
...
@@ -4,6 +4,8 @@ from operator import attrgetter
from
django.test
import
TestCase
from
django.db
import
models
from
.models
import
Post
,
Question
,
Answer
...
...
@@ -71,3 +73,22 @@ class OrderWithRespectToTests(TestCase):
Post
.
objects
.
create
(
title
=
"2.1"
,
parent
=
p2
)
p1_3
=
Post
.
objects
.
create
(
title
=
"1.3"
,
parent
=
p1
)
self
.
assertEqual
(
p1
.
get_post_order
(),
[
p1_1
.
pk
,
p1_2
.
pk
,
p1_3
.
pk
])
def
test_duplicate_order_field
(
self
):
class
Bar
(
models
.
Model
):
pass
class
Foo
(
models
.
Model
):
bar
=
models
.
ForeignKey
(
Bar
)
order
=
models
.
OrderWrt
()
class
Meta
:
order_with_respect_to
=
'bar'
count
=
0
for
field
in
Foo
.
_meta
.
local_fields
:
if
isinstance
(
field
,
models
.
OrderWrt
):
count
+=
1
self
.
assertEqual
(
count
,
1
)
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