# Copyright (C) 2012 FinalsClub Foundation
from django.views.generic import DetailView
+from django.views.generic import TemplateView
from karmaworld.apps.courses.models import Course
+from karmaworld.apps.courses.models import School
class CourseDetailView(DetailView):
""" Class-based view for the course html page """
model = Course
# name passed to template
context_object_name = u"course"
+
+
+class AboutView(TemplateView):
+ """ Display the About page with the Schools leaderboard """
+ template_name = "about.html"
+
+ def get_context_data(self, **kwargs):
+ """ get the list of schools with the most files for leaderboard """
+ context = { 'params': kwargs, \
+ 'schools': School.objects.all()[:3] }
+ return context
</div>
-<!-- <div class="row">
+ <div class="row">
<div id="leaderboard_table" class="ten columns offset-by-one">
- {% for school in leader_schools %}
+ {% for school in schools %}
<div class="row leaderboard_item">
<div class="one column leaderboard_rank">
{{ forloop.counter }}
</div>
<div class="eight columns leaderboard_school">
{{ school.name }}
- </div> /leaderboard_school
+ </div> <!-- /leaderboard_school -->
<div class="one column leaderboard_score">
- {{ school.karma|intcomma }}
- </div> /leaderboard_score
- </div> /leaderboard_item
+ {{ school.file_count }}
+ </div> <!-- /leaderboard_score -->
+ </div> <!-- /leaderboard_item -->
{% endfor %}
- </div> /leaderboard_table
+ </div> <!-- /leaderboard_table -->
</div>
--->
</section><!--/about_content-->
{% endblock %}
from karmaworld.apps.ajaxuploader.views import ajax_uploader
from karmaworld.apps.courses.models import Course
+from karmaworld.apps.courses.views import AboutView
from karmaworld.apps.courses.views import CourseDetailView
from karmaworld.apps.notes.views import NoteView
from karmaworld.apps.notes.views import raw_file
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
- url(r'^about/$', direct_to_template, { 'template': 'about.html' }, name='about'),
url(r'^terms/$', direct_to_template, { 'template': 'terms.html' }, name='terms'),
+ url(r'^about/$', AboutView.as_view(), name='about'),
+
url(r'^raw/(?P<pk>\d+)$', raw_file, name='note_raw'),
url(r'^(?P<school_slug>[^/]+)/(?P<slug>[^/]+)$', \
CourseDetailView.as_view(), name='course_detail'),