class django.views.generic.list.ListView¶
A page representing a list of objects.
While this view is executing, self.object_list will contain the list of objects
(usually, but not necessarily a queryset) that the view is operating upon.
Example views.py:
from django.utils import timezone
from django.views.generic.list import ListView
from articles.models import Article
class ArticleListView(ListView):
model = Article
paginate_by = 100 # if pagination is desired
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['now'] = timezone.now()
return context
Что именно представляет собой object_list? Это унаследовано? Вы должны определить это? Я sh документация будет иметь четкие объяснения, а не просматривать модули и модули и все еще не может найти его, спасибо, ребята