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
c9d0a0f7
Kaydet (Commit)
c9d0a0f7
authored
Haz 30, 2016
tarafından
Tim Graham
Kaydeden (comit)
GitHub
Haz 30, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #26002 -- Explained ModelAdmin.get_search_results() example.
üst
baff4dd3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
1 deletion
+6
-1
index.txt
docs/ref/contrib/admin/index.txt
+6
-1
No files found.
docs/ref/contrib/admin/index.txt
Dosyayı görüntüle @
c9d0a0f7
...
@@ -1398,7 +1398,7 @@ templates used by the :class:`ModelAdmin` views:
...
@@ -1398,7 +1398,7 @@ templates used by the :class:`ModelAdmin` views:
implemented by your search method may introduce duplicates into the results,
implemented by your search method may introduce duplicates into the results,
and return ``True`` in the second element of the return value.
and return ``True`` in the second element of the return value.
For example, to
enable search by integer field
, you could use::
For example, to
search by ``name`` and ``age``
, you could use::
class PersonAdmin(admin.ModelAdmin):
class PersonAdmin(admin.ModelAdmin):
list_display = ('name', 'age')
list_display = ('name', 'age')
...
@@ -1414,6 +1414,11 @@ templates used by the :class:`ModelAdmin` views:
...
@@ -1414,6 +1414,11 @@ templates used by the :class:`ModelAdmin` views:
queryset |= self.model.objects.filter(age=search_term_as_int)
queryset |= self.model.objects.filter(age=search_term_as_int)
return queryset, use_distinct
return queryset, use_distinct
This implementation is more efficient than ``search_fields =
('name', '=age')`` which results in a string comparison for the numeric
field, for example ``... OR UPPER("polls_choice"."votes"::text) = UPPER('4')``
on PostgreSQL.
.. method:: ModelAdmin.save_related(request, form, formsets, change)
.. method:: ModelAdmin.save_related(request, form, formsets, change)
The ``save_related`` method is given the ``HttpRequest``, the parent
The ``save_related`` method is given the ``HttpRequest``, the parent
...
...
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