📜  在 django 中创建博客 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:47.394000             🧑  作者: Mango

代码示例2
from django.views import generic
from .models import Post

class PostList(generic.ListView):
    queryset = Post.objects.filter(status=1).order_by('-created_on')
    template_name = 'index.html'

class PostDetail(generic.DetailView):
    model = Post
    template_name = 'post_detail.html'