From the course: Django Essential Training
Unlock this course with a free trial
Join today to access over 24,700 courses taught by industry experts.
How can Django can list data with just some small changes
From the course: Django Essential Training
How can Django can list data with just some small changes
- [Instructor] So far, you've learned how to create views using functions. However, Django has a couple more features that we can leverage to get things even simpler. Welcome to Class-Based Views. Most views have similar patterns, and reinventing the wheel is something nobody really wants. Class-based views are extensive classes that implement typical view behavior and you just need to override a few things to make it do what you want. This will allow us to avoid the boring work and focus on the things that are unique to our project. Let's go back to our code and change our views that are function-based to the ones that are class-based and see in detail how class-based views work. The first view we made was in the home app, so let's go back and change it. The only thing we need to do here is display a template. So we can do that by using the class-based view template view class. So let's in here import from django.views.generic. import TemplateView. Okay, so now we can create a new…
Contents
-
-
-
-
-
-
Creating a dynamic template5m 19s
-
(Locked)
Creating your first Django dynamic webpage5m 32s
-
(Locked)
How can Django can list data with just some small changes4m 58s
-
(Locked)
Introduction to Django class-based views: A few classes have the power to change the world3m 56s
-
(Locked)
</> Code challenge: Showing just popular notes1m 35s
-
(Locked)
Solution: Showing just popular notes2m 36s
-
-
-
-
-
-
-