importying listviewin django
from django.views.generic import ListView,TemplateView
from django.views.generic.base import View
from django.views.generic.detail import DetailView
importying listviewin django
from django.views.generic import ListView,TemplateView
from django.views.generic.base import View
from django.views.generic.detail import DetailView
django display view library
from django.views.generic.detail import DetailView
views.MainView.as_view(), name='all'
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
views.MainView.as_view(), name='all'
from django.urls import path
from article.views import ArticleDetailView
urlpatterns = [
path('<slug:slug>/', ArticleDetailView.as_view(), name='article-detail'),
]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us