class TodayArchiveView
[source]
A day archive page showing all objects for today. This is exactly the same as django.views.generic.dates.DayArchiveView
, except today’s date is used instead of the year
/month
/day
arguments.
Ancestors (MRO)
django.views.generic.list.MultipleObjectTemplateResponseMixin
django.views.generic.base.TemplateResponseMixin
django.views.generic.dates.BaseTodayArchiveView
django.views.generic.dates.BaseDayArchiveView
django.views.generic.dates.YearMixin
django.views.generic.dates.MonthMixin
django.views.generic.dates.DayMixin
django.views.generic.dates.BaseDateListView
django.views.generic.list.MultipleObjectMixin
django.views.generic.dates.DateMixin
django.views.generic.base.View
Notes
- Uses a default
template_name_suffix
of_archive_today
.
Example myapp/views.py:
from django.views.generic.dates import TodayArchiveView from myapp.models import Article class ArticleTodayArchiveView(TodayArchiveView): queryset = Article.objects.all() date_field = "pub_date" allow_future = True
Example myapp/urls.py:
from django.conf.urls import url from myapp.views import ArticleTodayArchiveView urlpatterns = [ url(r'^today/$', ArticleTodayArchiveView.as_view(), name="archive_today"), ]
Where is the example template for TodayArchiveView
?
This view uses by default the same template as the DayArchiveView
, which is in the previous example. If you need a different template, set the template_name
attribute to be the name of the new template.
Please login to continue.