]> git.parisson.com Git - teleforma.git/commitdiff
order all courses and documents by date_modified
authoryomguy <yomguy@parisson.com>
Fri, 13 Apr 2012 04:02:32 +0000 (06:02 +0200)
committeryomguy <yomguy@parisson.com>
Fri, 13 Apr 2012 04:02:32 +0000 (06:02 +0200)
teleforma/htdocs/css/teleforma.css
teleforma/models.py
teleforma/templates/teleforma/inc/conference_list.html
teleforma/templates/teleforma/inc/document_list.html
teleforma/templates/teleforma/inc/media_list.html
teleforma/views.py

index 06ea41a125fe85b8d187af68318e13fb93ddfc0e..da1b9c26b459c37b694b5d1e7b98aa3559f45f27 100644 (file)
@@ -1356,7 +1356,7 @@ input,textarea{
         font-size: 0.9125em;
         background-color: #FFF;
         color: #0000 ;
-        font-weight: normal;
+        font-weight: bold;
         max-height: 250px;
         overflow-y: scroll;
 
@@ -1426,10 +1426,10 @@ input,textarea{
     margin-top: 0.8em;
 }
 
+.course_subtitle {
+    padding: 0.3em;
 
-.course_content h2 {
-    padding: 0.5em 0.8em 0.8em 0.8em;
-    }
+}
 
 .course_content p {
     padding: 0.5em 0.8em 0.8em 0.8em;
index bb2550a8f3f7eda8723fe6017bec9e9fc2bc893d..c5416ab18111839fee4e52faf56b15af2730af9f 100755 (executable)
@@ -117,6 +117,7 @@ class Course(Model):
     description     = CharField(_('description'), max_length=255, blank=True)
     type            = ForeignKey('CourseType', related_name='course', verbose_name=_('course type'))
     code            = CharField(_('code'), max_length=255)
+    date_modified   = DateTimeField(_('date modified'), auto_now=True)
 
     notes = generic.GenericRelation(Note)
 
@@ -191,10 +192,13 @@ class Conference(Model):
 class MediaBase(Model):
     "Base media resource"
 
+    title           = CharField(_('title'), max_length=255, blank=True)
+    description     = CharField(_('description'), max_length=255, blank=True)
     credits         = CharField(_('credits'), max_length=255, blank=True)
     is_published    = BooleanField(_('published'))
     date_added      = DateTimeField(_('date added'), auto_now_add=True)
     date_modified   = DateTimeField(_('date modified'), auto_now=True)
+    code            = CharField(_('code'), max_length=255, blank=True)
 
     notes = generic.GenericRelation(Note)
 
@@ -203,16 +207,12 @@ class MediaBase(Model):
 
     class Meta:
         abstract = True
-        ordering = ['-date_added']
 
 
 class Document(MediaBase):
 
     element_type = 'document'
 
-    title           = CharField(_('title'), max_length=255, blank=True)
-    description     = CharField(_('description'), max_length=255, blank=True)
-    code            = CharField(_('code'), max_length=255, blank=True)
     course          = ForeignKey('Course', related_name='document', verbose_name='course')
     conference      = ForeignKey('Conference', related_name='document', verbose_name=_('conference'),
                                  blank=True, null=True)
@@ -243,8 +243,13 @@ class Document(MediaBase):
     def get_read(self, user):
         return user in self.readers
 
+    def save(self, **kwargs):
+        super(Document, self).save(**kwargs)
+        self.course.save()
+
     class Meta:
         db_table = app_label + '_' + 'document'
+        ordering = ['-date_modified']
 
 
 class Media(MediaBase):
@@ -270,6 +275,7 @@ class Media(MediaBase):
 
     class Meta:
         db_table = app_label + '_' + 'media'
+        ordering = ['-date_modified']
 
 
 # STUDENT
index 62e2bf2bd00e1c0c92c2128462ea9a14e5fc3c45..875e24d87eb29cc2189b8c6e24a696ce8925bece 100644 (file)
@@ -2,13 +2,15 @@
 
 {% if course.conference.all %}
 <div class="course_content">
+<div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Conferences"%}</h3>
+</div>
     <table class="listing" width="100%">
     <thead>
         <tr>
         <th class="highlight">{% trans "Session" %}</th>
         <th>{% trans "Professor" %}</th>
-        <th>{% trans "Date added" %}</th>
+        <th>{% trans "Date begin" %}</th>
         </tr>
     </thead>
     <tbody>
index 93ec51dfb1649a44d8f1836ab16604da6c48df56..6b2d5e15e80da3256c2506550eaa90008c41a799 100644 (file)
@@ -2,15 +2,17 @@
 
 {% if course.document.all %}
 <div class="course_content">
+<div class="course_subtitle">
 <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Documents"%}</h3>
+</div>
 <table class="listing" width="100%">
     <thead>
         <tr>
         <th class="highlight">{% trans "Title" %}</th>
         <th>{% trans "Description" %}</th>
-        <th>{% trans "Date added" %}</th>
         <th>{% trans "Annal" %}</th>
-<!--         <th>{% trans "Download" %}</th> -->
+        <th>{% trans "Date modified" %}</th>
+        <th>{% trans "Download" %}</th>
         </tr>
     </thead>
     <tbody>
@@ -18,9 +20,9 @@
         <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
         <td><a href="{% url teleforma-document-view document.id %}" target="_blank">{{ document.title }}</a></td>
         <td>{{ document.description }}</td>
-        <td>{{ document.date_added }}</td>
         <td>{{ document.is_annal }}</td>
-        <!--<td><a href="{% url teleforma-document-view document.id %}"><img src="{% url telemeta-images "download.png" %}" width="20px" /></a></td>-->
+        <td>{{ document.date_added }}</td>
+        <td><a href="{% url teleforma-document-view document.id %}"><img src="{% url telemeta-images "download.png" %}" width="20px" /></a></td>
         </tr>
     {% endfor %}
     </tbody>
index d3f4a993d35f1e02d2e57bc61485c7f002d4a5e9..35072c0b209340273e920a83ebb28ae8b212cdfc 100644 (file)
@@ -2,13 +2,15 @@
 
 {% if course.media.all %}
 <div class="course_content">
+<div class="course_subtitle">
     <h3><img src="{% url telemeta-images "item_title.png" %}" style="vertical-align:middle" /> {% trans "Medias"%}</h3>
+</div>
     <table class="listing" width="100%">
     <thead>
         <tr>
         <th class="highlight">{% trans "Title" %}</th>
         <th>{% trans "Description" %}</th>
-        <th>{% trans "Date added" %}</th>
+        <th>{% trans "Date modified" %}</th>
         </tr>
     </thead>
     <tbody>
@@ -16,7 +18,7 @@
             <tr {% if not forloop.counter0|divisibleby:"2" %}class="odd"{% endif %}>
             <td><a href="{% url teleforma-media-detail media.id %}">{{ media.item.title }}</a></td>
             <td>{{ media.item.description }}</td>
-            <td>{{ media.date_added }}</td>
+            <td>{{ media.date_modified }}</td>
             </tr>
         {% endfor %}
     </tbody>
index eb9fdd2c0b22ce2fdcc39513b445280a84968405..177a252c282ad7feaf11612ac060bcc0bc023418 100755 (executable)
@@ -50,6 +50,7 @@ def get_courses(user):
         courses = Course.objects.all()
     else:
         courses = None
+    courses = courses.order_by('-date_modified')
     return courses
 
 def stream_from_file(__file):