420
Chapter 19
Linking to the edit_entry Page
Now we need to include a link to the
edit_entry
page for each entry on the
topic page:
--
snip--
{% for entry in entries %}
{{ entry.date_added|date:'M d, Y H:i' }}
{{ entry.text|linebreaks }}
Edit entry
--
snip--
We include the edit link after each entry’s
date and text has been dis-
played. We use the
{% url %}
template tag to determine the URL for the
named
URL pattern
edit_entry
, along with the ID attribute of the current
entry in the loop (
entry.id
). The link text
Edit entry appears
after each entry
on the page. Figure 19-3 shows what the topic page looks like with these links.
Figure 19-3: Each entry now has a link for editing that entry.
Learning Log now has most of the functionality it needs. Users can
add topics and entries, and read through any set of entries they want. In
the
next section, we’ll implement a user registration system so anyone can
make an account with Learning Log and create their own set of topics and
entries.
topic.html