From: yomguy Date: Sun, 7 Apr 2013 20:39:59 +0000 (+0200) Subject: update and fix annals pages, locales X-Git-Tag: 1.1~618 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=4da230eeb0d4145bf152de230f9b253d8d767d0a;p=teleforma.git update and fix annals pages, locales --- diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index a360c6c1..692ba725 100644 Binary files a/teleforma/locale/fr/LC_MESSAGES/django.mo and b/teleforma/locale/fr/LC_MESSAGES/django.mo differ diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index 13e87725..904400d4 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-03-19 14:58+0100\n" +"POT-Creation-Date: 2013-04-07 22:39+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Guillaume Pellerin \n" "Language-Team: LANGUAGE \n" @@ -268,9 +268,8 @@ msgid "training" msgstr "formation" #: models/crfpa.py:139 -#, fuzzy msgid "CRFPA student" -msgstr "étudiant" +msgstr "Etudiant CRFPA" #: models/crfpa.py:147 templates/telemeta/profile_detail.html:82 msgid "Address" @@ -683,8 +682,8 @@ msgstr "" msgid "Write" msgstr "" -#: templates/teleforma/annals.html:6 templates/telemeta/base.html:102 -#: templates/telemeta/base.html.py:112 +#: templates/teleforma/annals.html:6 templates/teleforma/annals.html.py:54 +#: templates/telemeta/base.html:102 templates/telemeta/base.html.py:112 msgid "Annals" msgstr "Annales" @@ -694,13 +693,18 @@ msgstr "Annales" msgid "My courses" msgstr "Mes matières" -#: templates/teleforma/annals.html:67 +#: templates/teleforma/annals.html:49 +#: templates/teleforma/inc/document_list.html:36 +msgid "No document" +msgstr "Aucun document" + +#: templates/teleforma/annals.html:70 templates/teleforma/annals.html.py:72 #: templates/teleforma/inc/conference_list.html:18 #: templates/teleforma/inc/document_list.html:20 msgid "View" msgstr "Voir" -#: templates/teleforma/annals.html:68 templates/teleforma/course_media.html:63 +#: templates/teleforma/annals.html:75 templates/teleforma/course_media.html:63 #: templates/teleforma/inc/document_list.html:22 #: templates/teleforma/inc/media_list.html:56 msgid "Download" @@ -890,10 +894,6 @@ msgstr "Conférences en direct" msgid "Click here" msgstr "Cliquez ici" -#: templates/teleforma/inc/document_list.html:36 -msgid "No document" -msgstr "Aucun document" - #: templates/teleforma/inc/media_list.html:8 msgid "Passed conferences" msgstr "Conférences en différé" @@ -1007,9 +1007,8 @@ msgid "Sign in" msgstr "" #: templates/telemeta/profile_detail.html:6 -#, fuzzy msgid "User Profile" -msgstr "profil" +msgstr "Profil utilisateur" #: templates/telemeta/profile_detail.html:16 msgid "His courses" @@ -1020,9 +1019,8 @@ msgid "Send a message" msgstr "Envoyer un message" #: templates/telemeta/profile_detail.html:44 -#, fuzzy msgid "User profile" -msgstr "profil" +msgstr "Profil utilisateur" #: templates/telemeta/profile_detail.html:49 msgid "Change password" diff --git a/teleforma/static/teleforma/css/teleforma.css b/teleforma/static/teleforma/css/teleforma.css index c1bb42c6..74cd42c4 100644 --- a/teleforma/static/teleforma/css/teleforma.css +++ b/teleforma/static/teleforma/css/teleforma.css @@ -1471,7 +1471,7 @@ input,textarea{ .course_title { - color: #000; + color: #355ea2; -moz-border-radius: 8px 0px 0px 0px; -webkit-border-radius: 8px 0px 0px 0px; border-radius: 8px 0px 0px 0px; diff --git a/teleforma/templates/teleforma/annals.html b/teleforma/templates/teleforma/annals.html index fd385d25..1343b487 100644 --- a/teleforma/templates/teleforma/annals.html +++ b/teleforma/templates/teleforma/annals.html @@ -46,18 +46,20 @@
{% if not object_list.items %} - {% trans "No document" %} +
{% trans "No document" %}
{% else %} {% for course, iejs in object_list.items %} -
{{ course.title }}{% if auditor %} - {{ auditor.iej }}{% endif %}
+
{{ course.title }} - {% trans "Annals" %}
{% for iej, years in iejs.items %}
-

{{ iej }}

+ {% if not student %} +

{{ iej }}

+ {% endif %}
{% for year, docs in years.items %} diff --git a/teleforma/templates/telemeta/base.html b/teleforma/templates/telemeta/base.html index 94658d30..65574673 100644 --- a/teleforma/templates/telemeta/base.html +++ b/teleforma/templates/telemeta/base.html @@ -98,7 +98,8 @@ alt="logo" /> {% if user.is_staff %}
  • {% trans "Users" %}
  • - + {% else %} +
  • {% trans "Annals" %}
  • {% endif %} {% if user.is_authenticated %} diff --git a/teleforma/urls.py b/teleforma/urls.py index e4854065..d09d8bf8 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -72,9 +72,9 @@ urlpatterns = patterns('', url(r'^desk/documents/(?P.*)/view/$', document.view, name="teleforma-document-view"), - url(r'^desk/annals/$', AnnalsView.as_view(), name="teleforma-annals"), - url(r'^desk/annals/by-iej/(\w+)/$', AnnalsIEJView.as_view(), name="teleforma-annals-iej"), - url(r'^desk/annals/by-course/(\w+)/$', AnnalsCourseView.as_view(), name="teleforma-annals-course"), + url(r'^archives/annals/$', AnnalsView.as_view(), name="teleforma-annals"), + url(r'^archives/annals/by-iej/(\w+)/$', AnnalsIEJView.as_view(), name="teleforma-annals-iej"), + url(r'^archives/annals/by-course/(\w+)/$', AnnalsCourseView.as_view(), name="teleforma-annals-course"), url(r'^desk/conferences/(?P.*)/video/$', ConferenceView.as_view(), diff --git a/teleforma/views/crfpa.py b/teleforma/views/crfpa.py index e5559ac8..857534b3 100644 --- a/teleforma/views/crfpa.py +++ b/teleforma/views/crfpa.py @@ -298,44 +298,51 @@ class UsersXLSExport(object): return self.export(request) -def format_annals(docs): - annals = {} - for doc in docs: - if not doc.course in annals.keys(): - annals[doc.course] = {} - if not doc.iej in annals[doc.course].keys(): - annals[doc.course][doc.iej] = {} - if not doc.annal_year in annals[doc.course][doc.iej].keys(): - annals[doc.course][doc.iej][doc.annal_year] = [] - annals[doc.course][doc.iej][doc.annal_year].append(doc) - return annals - - class AnnalsView(ListView): model = Document template_name='teleforma/annals.html' + student = None - def get_queryset(self): - user = self.request.user - if user.is_staff or user.is_superuser or user.professor.all(): + def get_docs(self, iej=None, course=None): + students = self.user.crfpa_student.all() + annals = {} + courses = [c['course'] for c in self.all_courses] + + if self.user.is_staff or self.user.is_superuser or self.user.professor.all(): docs = Document.objects.filter(is_annal=True) - else: - auditors = user.auditor.all() - if auditors: - auditor = auditors[0] - docs = Document.objects.filter(is_annal=True, iej=auditor.iej) + elif students: + self.student = students[0] + docs = Document.objects.filter(is_annal=True, iej=self.student.iej) + if iej: + docs = docs.filter(iej=iej) + if course: + print course + docs = docs.filter(course=course) + + for doc in docs: + if doc.course in courses: + if not doc.course in annals.keys(): + annals[doc.course] = {} + if not doc.iej in annals[doc.course].keys(): + annals[doc.course][doc.iej] = {} + if not doc.annal_year in annals[doc.course][doc.iej].keys(): + annals[doc.course][doc.iej][doc.annal_year] = [] + annals[doc.course][doc.iej][doc.annal_year].append(doc) + return annals - return format_annals(docs) + def get_queryset(self): + self.user = self.request.user + self.all_courses = get_courses(self.request.user) + return self.get_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 + if self.student: + context['student'] = self.student + context['all_courses'] = self.all_courses return context @method_decorator(login_required) @@ -346,15 +353,17 @@ class AnnalsView(ListView): class AnnalsIEJView(AnnalsView): def get_queryset(self): + self.user = self.request.user + self.all_courses = get_courses(self.user) self.iej = IEJ.objects.filter(id=self.args[0]) - docs = Document.objects.filter(is_annal=True, iej=self.iej) - return format_annals(docs) + return self.get_docs(iej=self.iej) class AnnalsCourseView(AnnalsView): def get_queryset(self): + self.user = self.request.user + self.all_courses = get_courses(self.user) self.course = Course.objects.filter(id=self.args[0]) - docs = Document.objects.filter(is_annal=True, course=self.course) - return format_annals(docs) + return self.get_docs(course=self.course)