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
3990d740
Kaydet (Commit)
3990d740
authored
Mar 24, 2018
tarafından
AK
Kaydeden (comit)
Tim Graham
Mar 26, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Added a pagination example to ListView docs.
üst
4554f9a7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
generic-display.txt
docs/ref/class-based-views/generic-display.txt
+5
-0
pagination.txt
docs/topics/pagination.txt
+4
-1
No files found.
docs/ref/class-based-views/generic-display.txt
Dosyayı görüntüle @
3990d740
...
@@ -115,6 +115,7 @@ many projects they are typically the most commonly used views.
...
@@ -115,6 +115,7 @@ many projects they are typically the most commonly used views.
class ArticleListView(ListView):
class ArticleListView(ListView):
model = Article
model = Article
paginate_by = 100 # if pagination is desired
def get_context_data(self, **kwargs):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
...
@@ -144,6 +145,10 @@ many projects they are typically the most commonly used views.
...
@@ -144,6 +145,10 @@ many projects they are typically the most commonly used views.
{% endfor %}
{% endfor %}
</ul>
</ul>
If you're using pagination, you can adapt the :ref:`example template from
the pagination docs <using-paginator-in-view>`. Change instances of
``contacts`` in that example template to ``page_obj``.
.. class:: django.views.generic.list.BaseListView
.. class:: django.views.generic.list.BaseListView
A base view for displaying a list of objects. It is not intended to be used
A base view for displaying a list of objects. It is not intended to be used
...
...
docs/topics/pagination.txt
Dosyayı görüntüle @
3990d740
...
@@ -74,6 +74,7 @@ page::
...
@@ -74,6 +74,7 @@ page::
objects such as Django's ``QuerySet`` to use a more efficient ``count()``
objects such as Django's ``QuerySet`` to use a more efficient ``count()``
method when available.
method when available.
.. _using-paginator-in-view:
Using ``Paginator`` in a view
Using ``Paginator`` in a view
==============================
==============================
...
@@ -97,7 +98,9 @@ The view function looks like this::
...
@@ -97,7 +98,9 @@ The view function looks like this::
return render(request, 'list.html', {'contacts': contacts})
return render(request, 'list.html', {'contacts': contacts})
In the template :file:`list.html`, you'll want to include navigation between
In the template :file:`list.html`, you'll want to include navigation between
pages along with any interesting information from the objects themselves::
pages along with any interesting information from the objects themselves:
.. code-block:: html+django
{% for contact in contacts %}
{% for contact in contacts %}
{# Each "contact" is a Contact model object. #}
{# Each "contact" is a Contact model object. #}
...
...
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