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
17a0a666
Kaydet (Commit)
17a0a666
authored
Tem 21, 2016
tarafından
Kevan Swanberg
Kaydeden (comit)
Tim Graham
Tem 21, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #26796 -- Fixed ManyToManyField's limit_choices_to warning without a through model.
üst
d7a09726
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
related.py
django/db/models/fields/related.py
+2
-1
test_relative_fields.py
tests/invalid_models_tests/test_relative_fields.py
+9
-0
No files found.
django/db/models/fields/related.py
Dosyayı görüntüle @
17a0a666
...
...
@@ -1228,7 +1228,8 @@ class ManyToManyField(RelatedField):
id
=
'fields.W341'
,
)
)
if
self
.
remote_field
.
limit_choices_to
and
self
.
remote_field
.
through
:
if
(
self
.
remote_field
.
limit_choices_to
and
self
.
remote_field
.
through
and
not
self
.
remote_field
.
through
.
_meta
.
auto_created
):
warnings
.
append
(
checks
.
Warning
(
'limit_choices_to has no effect on ManyToManyField '
...
...
tests/invalid_models_tests/test_relative_fields.py
Dosyayı görüntüle @
17a0a666
...
...
@@ -176,6 +176,15 @@ class RelativeFieldTests(SimpleTestCase):
field
=
Model
.
_meta
.
get_field
(
'm2m'
)
self
.
assertEqual
(
field
.
check
(
from_model
=
Model
),
[])
def
test_many_to_many_with_limit_choices_auto_created_no_warning
(
self
):
class
Model
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
)
class
ModelM2M
(
models
.
Model
):
m2m
=
models
.
ManyToManyField
(
Model
,
limit_choices_to
=
{
'name'
:
'test_name'
})
self
.
assertEqual
(
ModelM2M
.
check
(),
[])
def
test_many_to_many_with_useless_options
(
self
):
class
Model
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
20
)
...
...
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