ae2856e8f8dc

Split the projects by type really fast.  This can be done better.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Fri, 21 Aug 2009 18:29:07 -0400
parents 07711504f5f9
children dbf5fe560ec3
branches/tags (none)
files projects/views.py templates/projects/list.html

Changes

--- a/projects/views.py	Thu Jul 30 06:10:18 2009 -0400
+++ b/projects/views.py	Fri Aug 21 18:29:07 2009 -0400
@@ -17,8 +17,10 @@
                               { 'project': project, 'comments': comments })
 
 def list(request):
-    projects = Project.objects.all().order_by('-posted')
-    return render_to_response('projects/list.html', { 'projects': projects, })
+    photo = Project.objects.filter(type='photography').order_by('-posted')
+    programming = Project.objects.filter(type='programming').order_by('-posted')
+    return render_to_response('projects/list.html',
+        {'photo': photo, 'programming': programming})
 
 def comment(request):
     fields = request.POST
--- a/templates/projects/list.html	Thu Jul 30 06:10:18 2009 -0400
+++ b/templates/projects/list.html	Fri Aug 21 18:29:07 2009 -0400
@@ -3,7 +3,31 @@
 
 {% block content %}
     <div id="projects-list">
-        {% for project in projects %}
+        <div class="projects-list-entry">
+            <h2 class="projects-list-entry-title">Programming</h2>
+            <p class="projects-list-entry-snip">&nbsp;</p>
+        </div>
+        {% for project in programming %}
+            <div class="projects-list-entry">
+                <h2 class="projects-list-entry-title">
+                    <a href="{{ project.get_absolute_url }}">
+                        {{ project.name|typogrify }}
+                    </a>
+                </h2>
+                <p class="projects-list-entry-snip">{{ project.snip|typogrify }}</p>
+            </div>
+        {% endfor %}
+        
+        <div class="projects-list-entry">
+            <h2 class="projects-list-entry-title">&nbsp;</h2>
+            <p class="projects-list-entry-snip">&nbsp;</p>
+        </div>
+        
+        <div class="projects-list-entry">
+            <h2 class="projects-list-entry-title">Photography</h2>
+            <p class="projects-list-entry-snip">&nbsp;</p>
+        </div>
+        {% for project in photo %}
             <div class="projects-list-entry">
                 <h2 class="projects-list-entry-title">
                     <a href="{{ project.get_absolute_url }}">