views mainview as view 28 29 2c name 3d 27all 27

Solutions on MaxInterview for views mainview as view 28 29 2c name 3d 27all 27 by the best coders in the world

showing results for - "views mainview as view 28 29 2c name 3d 27all 27"
Bridie
15 Mar 2016
1from django.utils import timezone
2from django.views.generic.list import ListView
3
4from articles.models import Article
5
6class ArticleListView(ListView):
7
8    model = Article
9    paginate_by = 100  # if pagination is desired
10
11    def get_context_data(self, **kwargs):
12        context = super().get_context_data(**kwargs)
13        context['now'] = timezone.now()
14        return context
15
Gareth
25 Jan 2019
1from django.urls import path
2
3from article.views import ArticleDetailView
4
5urlpatterns = [
6    path('<slug:slug>/', ArticleDetailView.as_view(), name='article-detail'),
7]
8