adding note count to homepage intro text
authorSeth Woodworth <seth@sethish.com>
Wed, 22 May 2013 20:43:11 +0000 (16:43 -0400)
committerSeth Woodworth <seth@sethish.com>
Wed, 22 May 2013 20:43:11 +0000 (16:43 -0400)
karmaworld/apps/courses/views.py
karmaworld/templates/courses/course_list.html

index 9964f9f3093fffc293ee95ad3165ca809b08d034..cc6fe00548b315296155b35a077fd0e3738dae63 100644 (file)
@@ -15,6 +15,7 @@ from django.views.generic.list import ListView
 from karmaworld.apps.courses.forms import CourseForm
 from karmaworld.apps.courses.models import Course
 from karmaworld.apps.courses.models import School
+from karmaworld.apps.notes.models import Note
 
 
 class CourseListView(ListView, ModelFormMixin, ProcessFormView):
@@ -27,6 +28,9 @@ class CourseListView(ListView, ModelFormMixin, ProcessFormView):
         """ Add the CourseForm to ListView context """
         # get the original context
         context = super(CourseListView, self).get_context_data(**kwargs)
+        # get the total number of notes
+        context['note_count'] = Note.objects.count()
+        # get the course form for the form at the bottom of the homepage
         context['course_form'] = kwargs.get('course_form', CourseForm())
         if context['course_form'].errors:
             # if there was an error in the form
index cc18a4b08c2f1848a23c80ad6bd5d6a1d96a4e43..cf1f258bb7eb557cf1cabf81d13ea1f8f74f6f23 100644 (file)
@@ -98,7 +98,7 @@ $(document).ready(function() {
     <div class="row">
       <div id="subhead" class="ten columns offset-by-one">
         <img src='{{ STATIC_URL }}img/noun_project_6858.svg' alt="Pieter J. Smits, from The Noun Project">
-        <span>Share and access a growing database of college lecture notes</span>
+        <span>Access a growing database of {{ note_count }} college lecture notes</span>
       </div>
     </div>
   </div>