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
4261ba67
Kaydet (Commit)
4261ba67
authored
Agu 03, 2018
tarafından
Adam Johnson
Kaydeden (comit)
Tim Graham
Agu 03, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
[2.1.x] Clarified the values accepted by ModelAdmin.fields.
Backport of
45086c29
from master
üst
1593a838
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
index.txt
docs/ref/contrib/admin/index.txt
+10
-12
No files found.
docs/ref/contrib/admin/index.txt
Dosyayı görüntüle @
4261ba67
...
...
@@ -308,9 +308,9 @@ subclass::
For more complex layout needs, see the :attr:`~ModelAdmin.fieldsets` option.
The ``fields`` option
, unlike :attr:`~ModelAdmin.list_display`, may only
contain names of fields on the model or the form specified by
:attr:`~ModelAdmin.form`. It may contain callables only if they a
re listed
The ``fields`` option
accepts the same types of values as
:attr:`~ModelAdmin.list_display`, except that callables aren't accepted.
Names of model and model admin methods will only be used if they'
re listed
in :attr:`~ModelAdmin.readonly_fields`.
To display multiple fields on the same line, wrap those fields in their own
...
...
@@ -550,15 +550,14 @@ subclass::
If you don't set ``list_display``, the admin site will display a single
column that displays the ``__str__()`` representation of each object.
You have four possible
values that can be used in ``list_display``:
There are four types of
values that can be used in ``list_display``:
*
A field of the model
. For example::
*
The name of a model field
. For example::
class PersonAdmin(admin.ModelAdmin):
list_display = ('first_name', 'last_name')
* A callable that accepts one parameter for the model instance. For
example::
* A callable that accepts one argument, the model instance. For example::
def upper_case_name(obj):
return ("%s %s" % (obj.first_name, obj.last_name)).upper()
...
...
@@ -567,8 +566,8 @@ subclass::
class PersonAdmin(admin.ModelAdmin):
list_display = (upper_case_name,)
* A string representing a
n attribute on the ``ModelAdmin``. This
behaves same as the callabl
e. For example::
* A string representing a
``ModelAdmin`` method that accepts one argument,
the model instanc
e. For example::
class PersonAdmin(admin.ModelAdmin):
list_display = ('upper_case_name',)
...
...
@@ -577,9 +576,8 @@ subclass::
return ("%s %s" % (obj.first_name, obj.last_name)).upper()
upper_case_name.short_description = 'Name'
* A string representing an attribute on the model. This behaves almost
the same as the callable, but ``self`` in this context is the model
instance. Here's a full model example::
* A string representing a model attribute or method (without any required
arguments). For example::
from django.contrib import admin
from django.db import models
...
...
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