Django Tutorial for Beginners - 29 - Generic Views

thenewboston · 142K views · 2016 · 10:08

Open on YouTube

Web developmentPython, Ruby & scripting languagestutorial

Why Stack Overflow recommends it

Stack Overflow users link it when answering or asking about Django generic views, context_object_name and the album app that this tutorial series builds.

Recommended by 2 people across 2 different months, 2016 to 2021.

What it is

Part 29 of thenewboston's Django beginner series, a ten-minute screencast on Django's generic class-based views such as ListView and DetailView. It shows how to replace hand-written view functions with IndexView and DetailView classes in a small music album app.

What people said

Recommends Heiner Früh · 2018-06 · Stack Overflow · on “django.urls.exceptions.NoReverseMatch: Reverse for 'favorite' not found”

I can't see any url with the name favorite here, which is what the error is telling you as well: app_name = 'music' urlpatterns = [ url(r'^$',views.IndexView.as_view(), name='index'), url(r'^(?P<pk>[0-9]+)/$',views.DetailView.as_view(), name='details'), ] you probably copy pasted the details.html or you simly forgot to specify the "favorite" url in the app "music" EDIT: As you have clarified that you are unable to solve the problem on your onw: Change details.html as such: <form action="{% url 'music:favorite' album.id %}" method="post"> replace it with <form action="#" method="post"> you're site should then at least load. EDIT2: After watchich the youtube video you linked in your comment: a

Recommends Tom · 2021-03 · Stack Overflow · on “Django tutorial. Generic views. context_object_name = 'latest_question_list'”

Here's a YT video [this video] on Django generics which clears this up. Even without the context of this video's project, the project set up is small and extremely similar to the official Django 3 tutorials. I found it more useful than the accepted answer, if not at least supporting it.

Cites mk lkj · 2016-08 · Stack Overflow · on “Indext is missing a QuerySet. Define indext.model, indext.queryset - django”

Thank you. it works. but in the next tutorial: [this video] he did another way and it works to him although.. so what is the purpose of the function he enter into the class at the video? and why for him it worked?

Cites Maqbool Thoufeeq T · 2018-06 · Stack Overflow · on “django.urls.exceptions.NoReverseMatch: Reverse for 'favorite' not found”

[this video] I made this webapp based on this tutorial, there is no url named favorite. Actually I am stuck. Please help me