Dal corso: Django Essential Training
Sblocca questo corso con una prova gratuita
Iscriviti adesso per accedere a oltre 24.900 corsi tenuti da esperti del settore.
</> Code challenge: Showing just popular notes
Dal corso: Django Essential Training
</> Code challenge: Showing just popular notes
(upbeat music) - [Instructor] In this chapter, you've learned a little bit about class-based views and how powerful they are. Class-based views are pretty straightforward when we need something simple, but they can be a bit more challenging when you need to alter them. So let's try to get you a bit more familiarized with it. You learned how to list all notes. Now we want to create a second list view where we only want to display the notes that are popular, this is that have more than one like. Let's call it popular notes list view. To do that, you're going to need first to understand how a ListView retrieves data from our model. Second, you need to alter the QuerySet from the basic one listing everything to listen just what we want. This is a new filter. And third, you need to change how to query for notes that have more than one like, so how to actually implement that future. Although you can use the main documentation from Django, for class-based views, I particularly like the…
Contenuti
-
-
-
-
-
-
Creating a dynamic template5m 19s
-
(Bloccato)
Creating your first Django dynamic webpage5m 32s
-
(Bloccato)
How can Django can list data with just some small changes4m 58s
-
(Bloccato)
Introduction to Django class-based views: A few classes have the power to change the world3m 56s
-
(Bloccato)
</> Code challenge: Showing just popular notes1m 35s
-
(Bloccato)
Solution: Showing just popular notes2m 36s
-
-
-
-
-
-
-