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
21fd8041
Unverified
Kaydet (Commit)
21fd8041
authored
May 03, 2018
tarafından
Carlton Gibson
Kaydeden (comit)
GitHub
May 03, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Refs #29358 -- Corrected wording in primary key check message.
üst
816b8d95
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
3 deletions
+5
-3
base.py
django/db/models/base.py
+2
-1
checks.txt
docs/ref/checks.txt
+2
-1
test_models.py
tests/invalid_models_tests/test_models.py
+1
-1
No files found.
django/db/models/base.py
Dosyayı görüntüle @
21fd8041
...
...
@@ -1443,7 +1443,8 @@ class Model(metaclass=ModelBase):
if
sum
(
1
for
f
in
cls
.
_meta
.
local_fields
if
f
.
primary_key
)
>
1
:
errors
.
append
(
checks
.
Error
(
"Model can not contain more than one 'primary_key' field."
,
"The model cannot have more than one field with "
"'primary_key=True'."
,
obj
=
cls
,
id
=
'models.E026'
,
)
...
...
docs/ref/checks.txt
Dosyayı görüntüle @
21fd8041
...
...
@@ -295,7 +295,8 @@ Models
as it collides with the query lookup syntax.
* **models.E025**: The property ``<property name>`` clashes with a related
field accessor.
* **models.E026**: Model can not contain more than one ``primary_key`` field.
* **models.E026**: The model cannot have more than one field with
``primary_key=True``.
Security
--------
...
...
tests/invalid_models_tests/test_models.py
Dosyayı görüntüle @
21fd8041
...
...
@@ -724,7 +724,7 @@ class OtherModelTests(SimpleTestCase):
self
.
assertEqual
(
Model
.
check
(),
[
Error
(
"
Model can not contain more than one 'primary_key' field
."
,
"
The model cannot have more than one field with 'primary_key=True'
."
,
obj
=
Model
,
id
=
'models.E026'
,
)
...
...
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