]> gitweb.fperrin.net Git - djsite.git/commitdiff
Add an index page
authorFrédéric Perrin <frederic.perrin@resel.fr>
Fri, 4 Nov 2016 18:22:47 +0000 (18:22 +0000)
committerFrédéric Perrin <frederic.perrin@resel.fr>
Fri, 4 Nov 2016 18:22:47 +0000 (18:22 +0000)
quotes/templates/quotes/index.html [new file with mode: 0644]
quotes/urls.py
quotes/views.py

diff --git a/quotes/templates/quotes/index.html b/quotes/templates/quotes/index.html
new file mode 100644 (file)
index 0000000..509f310
--- /dev/null
@@ -0,0 +1,17 @@
+{% extends 'quotes/base.html' %}
+
+{% block title %}Index page{% endblock %}
+
+{% block body %}
+
+<p><a href="all/">All the quotes in the database</a></p>
+
+<p><a href="random/">One random quote</a></p>
+
+<p><a href="show/1/">The first quote ever added</a></p>
+
+<p><a href="author/1/">The first author ever added</a></p>
+
+<p><a href="search/">Search page for quotes</a></p>
+
+{% endblock %}
index 13323a49bd41dfbaccd39d1eaa0607cef06b8613..f05a3fcb3786a7135ffd862e7bb18b01bb1b8046 100644 (file)
@@ -3,7 +3,7 @@ from django.conf.urls import url
 from . import views
 
 urlpatterns = [
-    url(r'^$', views.random, name='random'),
+    url(r'^$', views.index, name='index'),
 
     url(r'^random$', views.random, name='random'),
     url(r'^random/$', views.random, name='random'),
index 2aca193501b703c79ac77177000fbfc92102ae05..2171062cf781702aa881dcd7c49feca9826a8f79 100644 (file)
@@ -6,6 +6,9 @@ from quotes.models import Author, Work, Quote, QuoteTag
 import quotes.search as search
 
 # Create your views here.
+def index(request):
+    return render(request, 'quotes/index.html')
+
 def onequote(request, quote_id):
     q = Quote.objects.get(id=quote_id)
     q.incr_display()