]> git.parisson.com Git - teleforma.git/commitdiff
fix course order for desk (courses as a list of dict only)
authoryomguy <yomguy@parisson.com>
Fri, 8 Jun 2012 14:05:42 +0000 (16:05 +0200)
committeryomguy <yomguy@parisson.com>
Fri, 8 Jun 2012 14:05:42 +0000 (16:05 +0200)
teleforma/models.py
teleforma/views.py

index 6de9ea24929d51eda53e62d31952bad5fef39eb8..0fc110fcdd263043508a25c0f673bc5caea9c115 100755 (executable)
@@ -142,7 +142,7 @@ class Course(Model):
     class Meta:
         db_table = app_label + '_' + 'course'
         verbose_name = _('course')
-        ordering = ['-date_modified']
+        ordering = ['number']
 
 
 class Professor(Model):
index be6aa30559707958f0e870ac4643a75443e9aa23..076557187a46ad2cb730e727301490b751bac104 100755 (executable)
@@ -91,6 +91,8 @@ def get_courses(user):
                             queryset=Course.objects.filter(magistral=True),
                             types=magistral)
 
+        courses = sorted(courses, key=lambda k: k['date'], reverse=True)
+
     elif user.is_staff:
         courses = format_courses(courses, queryset=Course.objects.all(),
                     types=CourseType.objects)