Class-based views (CBVs) ทำให้ view เป็นคลาส Python แทน function ช่วยให้นำกลับมาใช้ใหม่ได้ผ่าน inheritance และ mixin Generic views เป็น CBV ที่มีมาในตัวซึ่งจัดการแพตเทิร์นทั่วไป (การ list, detail, create/update/delete) ด้วยโค้ดน้อยที่สุด — ลด boilerplate อย่างมากสำหรับ CRUD มาตรฐาน
function-based เทียบกับ class-based
():
articles = Article.objects.()
render(request, , {: articles})
django.views.generic ListView
():
model = Article
template_name =
context_object_name =
