From a1b255c7a8e4cabb054ac1dab7113015020e1090 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 13 May 2014 10:52:23 -0400 Subject: [PATCH] Remove old code from before course list was loaded over ajax --- karmaworld/apps/courses/views.py | 21 +++----- .../templates/courses/course_list_entry.html | 50 ------------------- 2 files changed, 8 insertions(+), 63 deletions(-) delete mode 100644 karmaworld/templates/courses/course_list_entry.html diff --git a/karmaworld/apps/courses/views.py b/karmaworld/apps/courses/views.py index ecdf9b4..32e600d 100644 --- a/karmaworld/apps/courses/views.py +++ b/karmaworld/apps/courses/views.py @@ -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 index 0f613dd..0000000 --- a/karmaworld/templates/courses/course_list_entry.html +++ /dev/null @@ -1,50 +0,0 @@ - - {{ course.updated_at|date:"U" }} - {{ course.file_count|stringformat:"010g" }} - {{ course.thank_count|stringformat:"010g" }} - {% if course.school %} - {{ course.school.name }} - {% else %} - {{ course.department.school.name }} - {% endif %} - - -
-
- - {% if course.school.name %} - {{ course.school.name }} - {% endif %} - {% if course.department.school.name %} - {{ course.department.school.name }} - {% endif %} - - {% if course.department %} -   •   - {{ course.department.name }} - {% endif %} - {% if course.instructor_name %} -   •   - {{ course.instructor_name }} - {% endif %} - {% if course.instructor.name %} -   •   - {% for prof in course.professor.all %} - {{ prof.name }}{% if not forloop.last %},{% endif %} - {% endfor %} - {% endif %} -
- -
- {{ course.name }} -
- -
-   {{ course.file_count }} Notes -   {{ course.thank_count }} Thanks - Updated {{ course.updated_at|date:"b d, o"|capfirst }} -
-
- - - -- 2.25.1