The Course App — Part 2

Adding navigation between templates

Want more?

This lesson for enrolled students only. Join the course to unlock it!

You can see the code changes implemented in this lecture below.

If you have purchased the course in a different platform, you still have access to the code changes per lecture here on Teclado. The lecture video and lecture notes remain locked.
Join course for $15

Modified files

templates/app/home.html
--- 
+++ 
@@ -2,9 +2,11 @@

 {% block content %}
   <h1>Articles</h1>
+
+  <a href="{% url 'create_article' %}">Create article</a>
   <ul>
     {% for article in articles %}
-      <li>{{ article.title }} with {{ article.word_count }} words.</li>
+      <li><a href="{% url 'update_article' article.id %}">{{ article.title }}</a> with {{ article.word_count }} words.</li>
     {% endfor %}
   </ul>
 {% endblock content %}
templates/app/article_update.html
--- 
+++ 
@@ -8,4 +8,7 @@
     {{ form.as_p }}
     <button type="submit">Save</button>
   </form>
+
+  <a href="{% url 'home' %}">Back to list</a>
+  <a href="{% url 'delete_article' article.id %}">Delete article</a>
 {% endblock content %}
templates/app/article_create.html
--- 
+++ 
@@ -7,4 +7,6 @@
     {{ form.as_p }}
     <button type="submit">Save</button>
   </form>
+
+  <a href="{% url 'home' %}">Back to list</a>
 {% endblock content %}
templates/app/article_delete.html
--- 
+++ 
@@ -7,4 +7,6 @@
     {% csrf_token %}
     <button type="submit">Delete</button>
   </form>
+
+  <a href="{% url 'home' %}">No, take me back</a>
 {% endblock content %}