Add skeletons for views.
authorDavid ‘Bombe’ Roden <bombe@demoscenemusic.org>
Wed, 8 May 2013 23:06:38 +0000 (01:06 +0200)
committerDavid ‘Bombe’ Roden <bombe@demoscenemusic.org>
Wed, 8 May 2013 23:06:49 +0000 (01:06 +0200)
data/views.py
templates/base.html [new file with mode: 0644]
templates/home.html [new file with mode: 0644]

index 60f00ef..1ca48df 100644 (file)
@@ -1 +1,12 @@
-# Create your views here.
+# encoding: utf-8
+from django.shortcuts import render_to_response
+from django.http import HttpResponse
+
+from DemosceneMusic.data.models import Track
+
+def home(request):
+       tracks = Track.objects.all()
+       return render_to_response('templates/home.html', { 'tracks': tracks })
+
+def track(request, trackId):
+       return HttpResponse('Track: %s' % trackId)
diff --git a/templates/base.html b/templates/base.html
new file mode 100644 (file)
index 0000000..cb6e80a
--- /dev/null
@@ -0,0 +1,11 @@
+<html>
+       <head>
+               <title>{% block title %} – Demoscene Music{% endblock %}</title>
+       </head>
+       <body>
+               {% block content %}{% endblock %}
+               <div id="footer" align="center">
+                       demoscenemusic.org - &copy; 2013 David ‘Bombe’ Roden
+               </div>
+       </body>
+</html>
diff --git a/templates/home.html b/templates/home.html
new file mode 100644 (file)
index 0000000..d9378ad
--- /dev/null
@@ -0,0 +1,17 @@
+{% extends "templates/base.html" %}
+
+{% block title %}Home{{ block.super }}{% endblock %}
+
+{% block content %}
+
+<h1>Tracks</h1>
+
+{% for track in tracks %}
+
+       <div class="track">
+               <span class="name"><a href="/track/{{ track.id }}/">{{ track }}</a></span>
+       </div>
+
+{% endfor %}
+
+{% endblock content %}