March 2020
Intermediate to advanced
608 pages
17h 17m
English
For this and further recipes, we need to extend the music app and add list and detail views there:
# myproject/apps/music/views.pyfrom django.views.generic import ListView, DetailViewfrom django.utils.translation import ugettext_lazy as _from .models import Songclass SongList(ListView): model = Songclass SongDetail(DetailView): model = Song
# myproject/apps/music/urls.pyfrom django.urls import pathfrom .views import SongList, SongDetailapp_name = "music"urlpatterns = [ path("", SongList.as_view(), name="song_list"), path("<uuid:pk>/", SongDetail.as_view(), name="song_detail"),]