Remove old code from before course list was loaded over ajax
authorCharles Connell <charles@connells.org>
Tue, 13 May 2014 14:52:23 +0000 (10:52 -0400)
committerCharles Connell <charles@connells.org>
Tue, 13 May 2014 14:52:23 +0000 (10:52 -0400)
karmaworld/apps/courses/views.py
karmaworld/templates/courses/course_list_entry.html [deleted file]

index ecdf9b48266fae549a834632e59bf93a915fd5bd..32e600db026b698a4032aa12e0290289f2fe1521 100644 (file)
@@ -62,36 +62,31 @@ class CourseListView(View):
         return ret
 
 
-class CourseListSubView(ListView):
+class CourseListSubView(TemplateView):
     """ Lists all courses. Called by CourseListView. """
-    model = Course
-
-    def get_queryset(self):
-        return Course.objects.all().select_related('note_set', 'school', 'department', 'department__school')
+    template_name = 'courses/course_list.html'
 
     def get_context_data(self, **kwargs):
         """ Add the CourseForm to ListView context """
-        # get the original context
-        context = super(CourseListSubView, self).get_context_data(**kwargs)
         # get the total number of notes
-        context['note_count'] = Note.objects.count()
+        kwargs['note_count'] = Note.objects.count()
         # get the course form for the form at the bottom of the homepage
-        context['course_form'] = CourseForm()
+        kwargs['course_form'] = CourseForm()
 
         schools = set()
-        for course in self.object_list:
+        for course in Course.objects.all().select_related('school', 'department', 'department__school'):
             if course.school:
                 schools.add(course.school)
             elif course.department and course.department.school:
                 schools.add(course.department.school)
 
-        context['schools'] = sorted(list(schools), key=lambda x: x.name)
+        kwargs['schools'] = sorted(list(schools), key=lambda x: x.name)
 
         # Include settings constants for honeypot
         for key in ('HONEYPOT_FIELD_NAME', 'HONEYPOT_VALUE'):
-            context[key] = getattr(settings, key)
+            kwargs[key] = getattr(settings, key)
 
-        return context
+        return kwargs
 
 
 class CourseAddFormView(CreateView):
diff --git a/karmaworld/templates/courses/course_list_entry.html b/karmaworld/templates/courses/course_list_entry.html
deleted file mode 100644 (file)
index 0f613dd..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-<tr class="table-row">
-  <td class="hide">{{ course.updated_at|date:"U" }}</td>
-  <td class="hide">{{ course.file_count|stringformat:"010g" }}</td>
-  <td class="hide">{{ course.thank_count|stringformat:"010g" }}</td>
-  {% if course.school %}
-    <td class="hide">{{ course.school.name }}</td>
-  {% else %}
-    <td class="hide">{{ course.department.school.name }}</td>
-  {% endif %}
-
-  <td class="small-12 columns data-table-entry-wrapper">
-    <div class="data-table-entry">
-      <div class="table-entry-first-line">
-        <span class="table-school">
-          {% if course.school.name %}
-            {{ course.school.name }}
-          {% endif %}
-          {% if course.department.school.name %}
-            {{ course.department.school.name }}
-          {% endif %}
-        </span>
-        {% if course.department %}
-          &nbsp;&nbsp;&bull;&nbsp;&nbsp;
-          <span class="table-department">{{ course.department.name }}</span>
-        {% endif %}
-        {% if course.instructor_name %}
-          &nbsp;&nbsp;&bull;&nbsp;&nbsp;
-          <span class="table-instructor">{{ course.instructor_name }}</span>
-        {% endif %}
-        {% if course.instructor.name %}
-          &nbsp;&nbsp;&bull;&nbsp;&nbsp;
-          <span class="table-instructor">{% for prof in course.professor.all %}
-                {{ prof.name }}{% if not forloop.last %},{% endif %}
-              {% endfor %}</span>
-        {% endif %}
-      </div>
-
-      <div class="table-entry-second-line museo700">
-        <span class="table-course-name"><a href="{{ course.get_absolute_url }}">{{ course.name }}</a></span>
-      </div>
-
-      <div class="table-entry-third-line">
-        <span class="table-note-count"><i class="fa fa-file-text-o"></i>&nbsp;&nbsp;{{ course.file_count }} Notes</span>
-        <span class="table-thanks-count"><i class="fa fa-thumbs-up"></i>&nbsp;&nbsp;{{ course.thank_count }} Thanks </span>
-        <span>Updated {{ course.updated_at|date:"b d, o"|capfirst }}</span>
-      </div>
-    </div>
-
-  </td>
-</tr>