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.MultipleObjectTemplateResponseMixindjango.views.generic.base.TemplateResponseMixindjango.views.generic.dates.BaseTodayArchiveViewdjango.views.generic.dates.BaseDayArchiveViewdjango.views.generic.dates.YearMixindjango.views.generic.dates.MonthMixindjango.views.generic.dates.DayMixindjango.views.generic.dates.BaseDateListViewdjango.views.generic.list.MultipleObjectMixindjango.views.generic.dates.DateMixindjango.views.generic.base.View
Notes
- Uses a default
template_name_suffixof_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.