Expression detail page
Add a document detail page.
In this section
Displaying the details and content of an expression
Expression detail page
Now let's add an expression detail page that shows the content of a single expression of a work.
Add a new view to your views.py:
from django.views.generic import ListView, DetailView
from .models import Work, Expression
class WorkListView(ListView):
model = Work
class ExpressionDetailView(DetailView):
model = Expression
slug_field = 'frbr_uri'
slug_url_kwarg = 'frbr_uri'Add the new view to your urls.py:
from django.urls import path
from reader.views import *
urlpatterns = [
path('', WorkListView.as_view(), name="home"),
# the FRBR URI starts with a /
path('expression<path:frbr_uri>', ExpressionDetailView.as_view(), name="expression"),
]Now create a template called templates/reader/expression_detail.html. We'll start with just the title and the expression content.
If you visit an expression detail page, you'll see the title and some ugly content. In the next section we'll add formatting to the content.
Last updated