> For the complete documentation index, see [llms.txt](https://developers.laws.africa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.laws.africa/tutorials/module-1-build-a-legislation-reader/expression-detail-page.md).

# Expression 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`:

{% code title="views.py" %}

```python
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'
```

{% endcode %}

Add the new view to your `urls.py`:

{% code title="urls.py" %}

```python
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"),
]
```

{% endcode %}

Now create a template called `templates/reader/expression_detail.html`. We'll start with just the title and the expression content.

{% code title="expression\_detail.html" %}

```html
<html>
<head>
  <title>{{ expression.title }}</title>
</head>
<body>
  <a href="{% url 'home' %}">Home</a>

  <h1>{{ expression.title }}</h1>

  <div>{{ expression.content|safe }}</div>
</body>
```

{% endcode %}

{% hint style="info" %}
If there are other expressions on the same work (different language or date), how would the user find them?
{% endhint %}

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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://developers.laws.africa/tutorials/module-1-build-a-legislation-reader/expression-detail-page.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
