]> git.parisson.com Git - teleforma.git/commitdiff
simplify annal table, fix perm
authoryomguy <yomguy@parisson.com>
Thu, 4 Apr 2013 13:18:53 +0000 (15:18 +0200)
committeryomguy <yomguy@parisson.com>
Thu, 4 Apr 2013 13:18:53 +0000 (15:18 +0200)
teleforma/templates/teleforma/annals.html
teleforma/views/crfpa.py

index 1a9f7da3b86c1dc97b54d9fda51c053584a54d24..fd385d2578b05b784034477ed9cfe0391b592410 100644 (file)
@@ -51,7 +51,7 @@
 
        {% for course, iejs in object_list.items %}
 
-                       <div class="course_title">{{ course.title }}</div>
+                       <div class="course_title">{{ course.title }}{% if auditor %} - {{ auditor.iej }}{% endif %}</div>
                        <div class="course_content">
 
                        {% for iej, years in iejs.items %}
                                </div>
 
                                {% for year, docs in years.items %}
-                                       <span class="doc_type_title">{{ year }}</span>
                                        <table class="listing" width="100%">
                                            <tbody>
                                                {% for doc in docs %}
                                                <tr>
-                                               <td {% if forloop.first %}class="border-top"{% endif %} width="90%">{% if doc.file %}<a href="{% url teleforma-document-view doc.id %}" target="_blank" title="{% trans "View" %}"><img src="{{ STATIC_URL }}/teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ doc.title }}{% if doc.file %}</a>{% endif %}</td>
+                                               <td {% if forloop.first %}class="border-top"{% endif %} width="50%">{% if doc.file %}<a href="{% url teleforma-document-view doc.id %}" target="_blank" title="{% trans "View" %}"><img src="{{ STATIC_URL }}/teleforma/images/application-msword.png" style="vertical-align:middle" alt="" />{% endif %} {{ doc.title }}{% if doc.file %}</a>{% endif %}</td>
+
+                                                       <td {% if forloop.first %}class="border-top"{% endif %} width="40%">{% if doc.file %}<a href="{% url teleforma-document-view doc.id %}" target="_blank" title="{% trans "View" %}">{% endif %}{{ year }}{% if doc.file %}</a>{% endif %}</td>
+
+
                                                <td {% if forloop.first %}class="border-top"{% endif %} width="10%" align="center">{% if doc.file %}<a href="{% url teleforma-document-download doc.id %}"><img src="{{ STATIC_URL }}teleforma/images/download.png" style="vertical-align:middle" alt="" title="{% trans "Download" %}" /></a>{% endif %}</td>
                                                </tr>
                                                {% endfor %}
index 876311cadd2c5b3609907eecc463bceffacba853..e5559ac8a3ed00f0d9e6742dc95a33ccac40c363 100644 (file)
@@ -317,28 +317,28 @@ class AnnalsView(ListView):
     template_name='teleforma/annals.html'
 
     def get_queryset(self):
-        self.iej = None
         user = self.request.user
-
         if user.is_staff or user.is_superuser or user.professor.all():
             docs = Document.objects.filter(is_annal=True)
         else:
             auditors = user.auditor.all()
             if auditors:
                 auditor = auditors[0]
-                self.iej = auditor.iej
-                docs = Document.objects.filter(is_annal=True, iej=self.iej)
+                docs = Document.objects.filter(is_annal=True, iej=auditor.iej)
 
         return format_annals(docs)
 
     def get_context_data(self, **kwargs):
+        user = self.request.user
+        auditors = user.auditor.all()
         context = super(AnnalsView, self).get_context_data(**kwargs)
         context['iejs'] = IEJ.objects.all()
+        context['iej'] =  auditor.iej
         all_courses = get_courses(self.request.user)
         context['all_courses'] = all_courses
         return context
 
-    @method_decorator(permission_required('is_staff'))
+    @method_decorator(login_required)
     def dispatch(self, *args, **kwargs):
         return super(AnnalsView, self).dispatch(*args, **kwargs)
 
@@ -357,3 +357,4 @@ class AnnalsCourseView(AnnalsView):
         docs = Document.objects.filter(is_annal=True, course=self.course)
         return format_annals(docs)
 
+