Commits

Doug Tyler committed 92e12ae

Change "Hello, world\!" text on Home view to ordered list of User Stories

  • Participants
  • Parent commits 9eff307

Comments (0)

Files changed (2)

user_stories/stories/templates/stories/index.html

+<html>
+<head>
+<title>User Stories</title>
+<style type="text/css">
+/*body {background-color:yellow;}*/
+/*p {color:blue;}*/
+.priority {
+    border: 1px solid #aaa;
+    padding: 1px;
+    font-size: 60%;
+    font-weight: bold;
+}
+.priority-high {
+    background-color: pink;
+}
+.priority-medium {
+    background-color: yellow;
+}
+.priority-low {
+    background-color: lightgreen;
+}
+</style>
+</head>
+<body>
+    <ol>
+        {% for story in stories %}
+        <li>
+            <span class="priority priority-{{ story.priority|lower }}">{{ story.priority }}</span>
+            As a <span class="role role-{{ story.role|lower }}">{{ story.role }}</span>,
+            I want <span class="action">{{ story.action }}</span>
+            so that <span class="reason">{{ story.reason }}</span>.
+        </li>
+        {% endfor %}
+    </ol>
+</body>
+</html>

user_stories/stories/views.py

-from django.http import HttpResponse
-
+from django.shortcuts import render
+from models import UserStory
 
 def home(request):
-    return HttpResponse("Hello, world!")
+    context = {'stories': UserStory.objects.all()}
+    return render(request, 'stories/index.html', context)