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
6af23a45
Kaydet (Commit)
6af23a45
authored
Ara 19, 2016
tarafından
Henry Dang
Kaydeden (comit)
Tim Graham
Ara 19, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #27377 -- Clarified that prepopulated_fields doesn't work with OneToOneField.
üst
3e43d24a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
6 deletions
+19
-6
AUTHORS
AUTHORS
+1
-0
checks.py
django/contrib/admin/checks.py
+1
-1
checks.txt
docs/ref/checks.txt
+2
-2
index.txt
docs/ref/contrib/admin/index.txt
+1
-1
models.py
tests/modeladmin/models.py
+1
-0
tests.py
tests/modeladmin/tests.py
+13
-2
No files found.
AUTHORS
Dosyayı görüntüle @
6af23a45
...
...
@@ -299,6 +299,7 @@ answer newbie questions, and generally made Django that much better:
Hawkeye
Helen Sherwood-Taylor <helen@rrdlabs.co.uk>
Henrique Romano <onaiort@gmail.com>
Henry Dang <henrydangprg@gmail.com>
hipertracker@gmail.com
Hiroki Kiyohara <hirokiky@gmail.com>
Honza Král <honza.kral@gmail.com>
...
...
django/contrib/admin/checks.py
Dosyayı görüntüle @
6af23a45
...
...
@@ -399,7 +399,7 @@ class BaseModelAdminChecks(object):
return
[
checks
.
Error
(
"The value of '
%
s' refers to '
%
s', which must not be a DateTimeField, "
"a ForeignKey, or a ManyToManyField."
%
(
label
,
field_name
),
"a ForeignKey,
a OneToOneField,
or a ManyToManyField."
%
(
label
,
field_name
),
obj
=
obj
.
__class__
,
id
=
'admin.E028'
,
)
...
...
docs/ref/checks.txt
Dosyayı görüntüle @
6af23a45
...
...
@@ -343,8 +343,8 @@ with the admin site:
* **admin.E027**: The value of ``prepopulated_fields`` refers to
``<field name>``, which is not an attribute of ``<model>``.
* **admin.E028**: The value of ``prepopulated_fields`` refers to
``<field name>``, which must not be a ``DateTimeField``, a ``ForeignKey``,
or a
``ManyToManyField`` field.
``<field name>``, which must not be a ``DateTimeField``, a ``ForeignKey``,
a ``OneToOneField``, or a
``ManyToManyField`` field.
* **admin.E029**: The value of ``prepopulated_fields[<field name>]`` must be a
list or tuple.
* **admin.E030**: The value of ``prepopulated_fields`` refers to
...
...
docs/ref/contrib/admin/index.txt
Dosyayı görüntüle @
6af23a45
...
...
@@ -1059,7 +1059,7 @@ subclass::
slug (e.g. substituting dashes for spaces).
``prepopulated_fields`` doesn't accept ``DateTimeField``, ``ForeignKey``,
nor
``ManyToManyField`` fields.
``OneToOneField``, and
``ManyToManyField`` fields.
.. attribute:: ModelAdmin.preserve_filters
...
...
tests/modeladmin/models.py
Dosyayı görüntüle @
6af23a45
...
...
@@ -36,6 +36,7 @@ class ValidationTestModel(models.Model):
is_active
=
models
.
BooleanField
(
default
=
False
)
pub_date
=
models
.
DateTimeField
()
band
=
models
.
ForeignKey
(
Band
,
models
.
CASCADE
)
best_friend
=
models
.
OneToOneField
(
User
,
models
.
CASCADE
)
# This field is intentionally 2 characters long (#16080).
no
=
models
.
IntegerField
(
verbose_name
=
"Number"
,
blank
=
True
,
null
=
True
)
...
...
tests/modeladmin/tests.py
Dosyayı görüntüle @
6af23a45
...
...
@@ -1006,8 +1006,8 @@ class PrepopulatedFieldsCheckTests(CheckTestCase):
self
.
assertIsInvalid
(
ValidationTestModelAdmin
,
ValidationTestModel
,
(
"The value of 'prepopulated_fields' refers to 'users', which must not be "
"a DateTimeField, a ForeignKey, or a ManyToManyField."
)
,
"The value of 'prepopulated_fields' refers to 'users', which must not be "
"a DateTimeField, a ForeignKey, a OneToOneField, or a ManyToManyField."
,
'admin.E028'
)
def
test_valid_case
(
self
):
...
...
@@ -1016,6 +1016,17 @@ class PrepopulatedFieldsCheckTests(CheckTestCase):
self
.
assertIsValid
(
ValidationTestModelAdmin
,
ValidationTestModel
)
def
test_one_to_one_field
(
self
):
class
ValidationTestModelAdmin
(
ModelAdmin
):
prepopulated_fields
=
{
'best_friend'
:
(
'name'
,)}
self
.
assertIsInvalid
(
ValidationTestModelAdmin
,
ValidationTestModel
,
"The value of 'prepopulated_fields' refers to 'best_friend', which must not be "
"a DateTimeField, a ForeignKey, a OneToOneField, or a ManyToManyField."
,
'admin.E028'
)
class
ListDisplayTests
(
CheckTestCase
):
...
...
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