Jezzy Grey


class from descriptionSun, 19 Feb 2023

The views class for the django framework. Gets data from the form that is displayed in the html template

from django.views.generic import TemplateView from django.shortcuts import render from django.shortcuts import redirect from django.utils import timezone from .models import Post from .forms import PostForm from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect class PostListView(TemplateView): def get(self, request): posts = Post.objects.filter('published_date') return render(request, 'blog/post_list.html', {'posts': posts})

Questions about programming?Chat with your personal AI assistant