Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Class-based Views Classy Views ListView and DetailView

igsm '
igsm '
10,440 Points

Still missing the point of ListView and DetailView.

Sorry, but I still could not comprehend the point of using those two views? I replayed video few times and it seems that I am missing some explanation. There were two views already that we redefined by using class based views. At the end, they do the same thing as before. Can someone explain please once more, what are the real use cases and advantages of shown methodology? Thanks ;)

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,457 Points

The basic point is to show how basic views can be done in Class-Based Views (CBV) instead of function-based views. CBV's have been around a while, but are still relatively new to Django to most developers. One advantage of CBV is the large (and growing) collection of mixins that customize a CBS quickly. With function-based views, there isn't the inheritance option so a lot of cut and pasting happens, and can be difficult to keep the code DRY.

Hope I answered you question. Post back if you need more help. Good Luck!!

igsm '
igsm '
10,440 Points

Thanks for the answer.