Skip to content
Justice Tech School

Generic Views

ListView and DetailView reduce code.

Example
from django.views.generic import ListView, DetailView

class PostList(ListView):
    model = Post

class PostDetail(DetailView):
    model = Post

Exercise

List page.

class PostList():

Quiz Test

Which shows one object?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.