From: yomguy Date: Wed, 11 Apr 2012 08:09:03 +0000 (+0200) Subject: fix training user export, fix course title style X-Git-Tag: 0.2~65 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=576cab866c171e9851debde9cb2be2bcf335734f;p=teleforma.git fix training user export, fix course title style --- diff --git a/teleforma/htdocs/css/teleforma_black.css b/teleforma/htdocs/css/teleforma_black.css index be5dcfac..de400f40 100644 --- a/teleforma/htdocs/css/teleforma_black.css +++ b/teleforma/htdocs/css/teleforma_black.css @@ -1380,7 +1380,7 @@ input,textarea{ border-radius: 8px 0px 8px 8px; background:no-repeat url(../images/bg_yt.png) 0 0; background-color:#ebebeb; - background-repeat:repeat + background-repeat:repeat; } @@ -1389,7 +1389,7 @@ input,textarea{ -moz-border-radius: 8px 0px 0px 0px; -webkit-border-radius: 8px 0px 0px 0px; border-radius: 8px 0px 0px 0px; - padding: 0em 0.8em 0.8em 0em; + padding: 0em 0.8em 0em 0em; font-weight: bold; font-size: 1.2em; } @@ -1399,7 +1399,7 @@ input,textarea{ -moz-border-radius: 8px 0px 8px 8px; -webkit-border-radius: 8px 0px 8px 8px; border-radius: 8px 0px 8px 8px; - padding: 0em 0em 0em 0em; + padding: 0em 0em 0.1em 0em; } diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index 04325eec..7be6279c 100644 --- a/teleforma/locale/fr/LC_MESSAGES/django.po +++ b/teleforma/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-04-05 11:53+0200\n" +"POT-Creation-Date: 2012-04-11 10:01+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,38 +18,38 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1)\n" -#: models.py:63 models.py:75 models.py:89 models.py:102 models.py:148 -#: models.py:261 models.py:276 models.py:293 models.py:306 models.py:319 +#: models.py:64 models.py:76 models.py:90 models.py:103 models.py:151 +#: models.py:268 models.py:284 models.py:301 models.py:314 models.py:327 msgid "name" msgstr "nom" -#: models.py:64 models.py:76 models.py:90 models.py:103 models.py:116 -#: models.py:149 models.py:206 models.py:262 +#: models.py:65 models.py:77 models.py:91 models.py:104 models.py:117 +#: models.py:152 models.py:212 models.py:269 msgid "description" msgstr "description" -#: models.py:71 models.py:77 models.py:147 +#: models.py:72 models.py:78 models.py:150 msgid "organization" msgstr "organisation" -#: models.py:84 models.py:114 +#: models.py:85 models.py:115 msgid "department" msgstr "département" -#: models.py:97 models.py:117 models.py:333 +#: models.py:98 models.py:285 models.py:341 msgid "category" msgstr "catégorie" -#: models.py:98 +#: models.py:99 msgid "categories" msgstr "catégories" -#: models.py:110 +#: models.py:111 #, fuzzy msgid "type" msgstr "type mime" -#: models.py:115 models.py:205 +#: models.py:116 models.py:211 msgid "title" msgstr "titre" @@ -57,160 +57,160 @@ msgstr "titre" msgid "course type" msgstr "type de matière" -#: models.py:119 models.py:207 models.py:275 models.py:294 models.py:307 -#: models.py:320 +#: models.py:119 models.py:213 models.py:283 models.py:302 models.py:315 +#: models.py:328 msgid "code" msgstr "cote" -#: models.py:128 models.py:161 +#: models.py:130 models.py:164 msgid "course" msgstr "matière" -#: models.py:133 models.py:332 models.py:359 +#: models.py:136 models.py:340 models.py:367 msgid "user" msgstr "utilisateur" -#: models.py:134 models.py:277 +#: models.py:137 models.py:286 msgid "courses" msgstr "matières" -#: models.py:142 models.py:162 +#: models.py:145 models.py:165 msgid "professor" msgstr "professeur" -#: models.py:156 models.py:165 +#: models.py:159 models.py:168 msgid "room" msgstr "salle" -#: models.py:163 +#: models.py:166 msgid "session" msgstr "session" -#: models.py:167 +#: models.py:170 msgid "comment" msgstr "" -#: models.py:168 +#: models.py:171 msgid "begin date" msgstr "date de début" -#: models.py:169 +#: models.py:172 msgid "end date" msgstr "date de fin" -#: models.py:182 models.py:209 models.py:240 +#: models.py:185 models.py:215 models.py:246 msgid "conference" msgstr "conférence" -#: models.py:188 +#: models.py:192 msgid "credits" msgstr "crédits" -#: models.py:189 +#: models.py:193 msgid "published" msgstr "publié" -#: models.py:190 +#: models.py:194 models.py:374 msgid "date added" msgstr "date d'ajout" -#: models.py:191 +#: models.py:195 msgid "date modified" msgstr "date de modification" -#: models.py:211 +#: models.py:217 msgid "annal" msgstr "annale" -#: models.py:212 +#: models.py:218 msgid "file" msgstr "fichier" -#: models.py:244 +#: models.py:250 msgid "is live" msgstr "en direct" -#: models.py:269 models.py:270 +#: models.py:276 models.py:277 templates/telemeta/inc/user_list.html:24 msgid "IEJ" msgstr "IEJ" -#: models.py:279 +#: models.py:288 msgid "synthesis note" msgstr "note de synthèse" -#: models.py:280 +#: models.py:289 msgid "obligation" msgstr "obligation" -#: models.py:288 models.py:336 +#: models.py:296 models.py:344 msgid "training" msgstr "formation" -#: models.py:301 models.py:338 +#: models.py:309 models.py:346 msgid "procedure" msgstr "procédure" -#: models.py:314 +#: models.py:322 msgid "speciality" msgstr "spécialité" -#: models.py:327 +#: models.py:335 msgid "oral" msgstr "" -#: models.py:334 +#: models.py:342 msgid "iej" msgstr "iej" -#: models.py:340 +#: models.py:348 msgid "oral speciality" msgstr "spécialité orale" -#: models.py:342 +#: models.py:350 msgid "written speciality" msgstr "spécialité écrit" -#: models.py:344 models.py:346 +#: models.py:352 models.py:354 msgid "oral 1" msgstr "" -#: models.py:353 +#: models.py:361 msgid "student" msgstr "étudiant" -#: models.py:360 +#: models.py:368 msgid "Address" msgstr "" -#: models.py:361 +#: models.py:369 msgid "Postal code" msgstr "Code postal" -#: models.py:362 +#: models.py:370 msgid "City" msgstr "Ville" -#: models.py:363 +#: models.py:371 msgid "Country" msgstr "Pays" -#: models.py:364 +#: models.py:372 msgid "Language" msgstr "Langue" -#: models.py:365 +#: models.py:373 msgid "Telephone" msgstr "Téléphone" -#: models.py:366 +#: models.py:375 msgid "Expiration_date" msgstr "Date d'expiration" -#: models.py:367 +#: models.py:376 msgid "Password initialization" msgstr "" -#: models.py:371 +#: models.py:380 msgid "profile" msgstr "profil" @@ -353,6 +353,7 @@ msgid "The site administrator" msgstr "" #: templates/postman/email_user.txt:18 +#: templates/telemeta/inc/user_list.html:10 msgid "of" msgstr "de" @@ -417,7 +418,7 @@ msgstr "" msgid "Conversation" msgstr "" -#: templates/postman/view.html:8 +#: templates/postman/view.html:8 templates/telemeta/inc/user_list.html:58 #, fuzzy msgid "Message" msgstr "Messages" @@ -439,67 +440,74 @@ msgid "Write" msgstr "" #: templates/teleforma/course.html:15 -#: templates/teleforma/inc/document_list.html:4 +#: templates/teleforma/inc/document_list.html:5 msgid "Documents" msgstr "Documents" #: templates/teleforma/course.html:18 templates/teleforma/course.html.py:34 -#: templates/teleforma/inc/document_list.html:8 -#: templates/teleforma/inc/media_list.html:8 +#: templates/teleforma/inc/document_list.html:9 +#: templates/teleforma/inc/media_list.html:9 msgid "Title" msgstr "Titre" #: templates/teleforma/course.html:19 templates/teleforma/course.html.py:35 -#: templates/teleforma/inc/document_list.html:9 -#: templates/teleforma/inc/media_list.html:9 +#: templates/teleforma/inc/document_list.html:10 +#: templates/teleforma/inc/media_list.html:10 msgid "Description" msgstr "Description" #: templates/teleforma/course.html:20 templates/teleforma/course.html.py:36 #: templates/teleforma/course.html:53 -#: templates/teleforma/inc/conference_list.html:10 -#: templates/teleforma/inc/document_list.html:10 -#: templates/teleforma/inc/media_list.html:10 +#: templates/teleforma/inc/conference_list.html:11 +#: templates/teleforma/inc/document_list.html:11 +#: templates/teleforma/inc/media_list.html:11 msgid "Date added" msgstr "Date d'ajout" #: templates/teleforma/course.html:31 -#: templates/teleforma/inc/media_list.html:4 +#: templates/teleforma/inc/media_list.html:5 msgid "Medias" msgstr "Médias" #: templates/teleforma/course.html:48 -#: templates/teleforma/inc/conference_list.html:4 +#: templates/teleforma/inc/conference_list.html:5 msgid "Conferences" msgstr "Conférences" #: templates/teleforma/course.html:51 -#: templates/teleforma/inc/conference_list.html:8 +#: templates/teleforma/inc/conference_list.html:9 msgid "Session" msgstr "Session" #: templates/teleforma/course.html:52 -#: templates/teleforma/inc/conference_list.html:9 +#: templates/teleforma/inc/conference_list.html:10 +#: templates/telemeta/inc/user_list.html:50 msgid "Professor" msgstr "Professeur" -#: templates/teleforma/course_detail.html:12 +#: templates/teleforma/course_media.html:52 +msgid "Recording date" +msgstr "date de d'enregistrement" + +#: templates/teleforma/course_media.html:67 +msgid "Questions" +msgstr "Questions" + +#: templates/teleforma/courses.html:13 +msgid "My courses" +msgstr "Mes matières" + +#: templates/teleforma/courses.html:27 msgid "My notes" msgstr "Mes notes" -#: templates/teleforma/course_detail.html:22 -#: templates/teleforma/courses.html:27 +#: templates/teleforma/courses.html:37 msgid "New note" msgstr "Nouvelle note" -#: templates/teleforma/course_media.html:48 -#, fuzzy -msgid "Recording date" -msgstr "date de début" - - #: templates/teleforma/courses.html:13 -msgid "My courses" -msgstr "Mes matières" +#: templates/teleforma/courses.html:71 +msgid "No document" +msgstr "Aucun document" #: templates/telemeta/base.html:63 msgid "Desk" @@ -513,16 +521,17 @@ msgstr "" msgid "Sign in" msgstr "" -#: templates/telemeta/base.html:71 templates/telemeta/inc/user_list.html:10 +#: templates/telemeta/base.html:72 templates/telemeta/inc/user_list.html:30 msgid "Messages" msgstr "Messages" -#: templates/telemeta/base.html:73 +#: templates/telemeta/base.html:74 templates/telemeta/users.html:5 +#: templates/telemeta/users.html.py:35 msgid "Users" msgstr "" -#: templates/telemeta/base.html:75 -msgid "Advanced search" +#: templates/telemeta/base.html:76 +msgid "Search" msgstr "" #: templates/telemeta/base.html:81 @@ -541,46 +550,46 @@ msgstr "" msgid "Items" msgstr "" -#: templates/telemeta/base.html:88 -msgid "Admin" -msgstr "" - -#: templates/telemeta/base.html:90 -msgid "General" +#: templates/telemeta/base.html:89 templates/telemeta/base.html.py:103 +msgid "Help" msgstr "" -#: templates/telemeta/base.html:102 +#: templates/telemeta/base.html:99 #, fuzzy msgid "Profile" msgstr "profil" -#: templates/telemeta/base.html:104 +#: templates/telemeta/base.html:101 msgid "Lists" msgstr "" -#: templates/telemeta/base.html:106 -msgid "Help" +#: templates/telemeta/base.html:104 +msgid "Sign out" msgstr "" -#: templates/telemeta/base.html:107 -msgid "Sign out" +#: templates/telemeta/base.html:109 +msgid "Admin" msgstr "" -#: templates/telemeta/base.html:148 +#: templates/telemeta/base.html:111 +msgid "General" +msgstr "" + +#: templates/telemeta/base.html:153 msgid "Powered by" msgstr "" -#: templates/telemeta/base.html:149 +#: templates/telemeta/base.html:154 msgid "By" msgstr "" -#: templates/telemeta/base.html:154 +#: templates/telemeta/base.html:159 msgid "" "Usage of the archives in the respect of cultural heritage of the original " "communities." msgstr "" -#: templates/telemeta/base.html:160 +#: templates/telemeta/base.html:165 msgid "Legal notices" msgstr "" @@ -588,21 +597,58 @@ msgstr "" msgid "Musical selection" msgstr "" -#: templates/telemeta/inc/user_list.html:7 -msgid "User" -msgstr "" +#: templates/telemeta/users.html:14 +msgid "Trainings" +msgstr "Formations" + +#: templates/telemeta/users.html:39 +#, fuzzy +msgid "No users" +msgstr "Pas d'utilisateurs" #: templates/telemeta/inc/user_list.html:8 -msgid "First Name" +msgid "Previous" +msgstr "" + +#: templates/telemeta/inc/user_list.html:10 +msgid "Page" +msgstr "" + +#: templates/telemeta/inc/user_list.html:12 +msgid "Next" msgstr "" -#: templates/telemeta/inc/user_list.html:9 +#: templates/telemeta/inc/user_list.html:21 msgid "Last Name" msgstr "" -#: templates/telemeta/inc/user_list.html:11 -msgid "Training" -msgstr "Formation" +#: templates/telemeta/inc/user_list.html:22 +msgid "First Name" +msgstr "" + +#: templates/telemeta/inc/user_list.html:23 +msgid "User" +msgstr "" + +#: templates/telemeta/inc/user_list.html:25 +msgid "Procedure" +msgstr "Procédure" + +#: templates/telemeta/inc/user_list.html:26 +msgid "Oral spe" +msgstr "Oral Spé" + +#: templates/telemeta/inc/user_list.html:27 +msgid "Written spe" +msgstr "Ecrit Spé" + +#: templates/telemeta/inc/user_list.html:28 +msgid "Oral 1" +msgstr "" + +#: templates/telemeta/inc/user_list.html:29 +msgid "Oral 2" +msgstr "" #, fuzzy #~ msgid "Last modification" diff --git a/teleforma/templates/telemeta/users.html b/teleforma/templates/telemeta/users.html index cc7758f5..176185e3 100644 --- a/teleforma/templates/telemeta/users.html +++ b/teleforma/templates/telemeta/users.html @@ -28,7 +28,7 @@ {% if user.is_staff %}
-XLS Export +XLS Export
{% endif %} diff --git a/teleforma/urls.py b/teleforma/urls.py index b8bcf520..e99c13db 100644 --- a/teleforma/urls.py +++ b/teleforma/urls.py @@ -59,10 +59,10 @@ urlpatterns = patterns('', url(r'^messages/', include('postman.urls')), # Users - url(r'^all_users/$', UsersView.as_view(), name="teleforma-users"), - url(r'^all_users/by_trainings/(\w+)$', UsersTrainingView.as_view(), name="teleforma-training-users"), - url(r'^all_users/export/$', user_export.export, name="teleforma-users-xls-export"), - url(r'^all_users/by_trainings/(\w+)/export/$', user_export.export_training, name="teleforma-training-users-export"), + url(r'^user/all/$', UsersView.as_view(), name="teleforma-users"), + url(r'^user/by_training/(\w+)$', UsersTrainingView.as_view(), name="teleforma-training-users"), + url(r'^user/all/export/$', user_export.all, name="teleforma-users-xls-export"), + url(r'^user/by_training/(?P.*)/export/$', user_export.by_training, name="teleforma-training-users-export"), # CSS+Images (FIXME: for developement only) url(r'^teleforma/css/(?P.*)$', 'django.views.static.serve', diff --git a/teleforma/views.py b/teleforma/views.py index 236cd218..cc7c00fa 100755 --- a/teleforma/views.py +++ b/teleforma/views.py @@ -140,29 +140,14 @@ class UsersTrainingView(UsersView): trainings = Training.objects.filter(id=self.args[0]) return User.objects.filter(student__training__in=trainings) + def get_context_data(self, **kwargs): + context = super(UsersTrainingView, self).get_context_data(**kwargs) + context['training'] = Training.objects.get(id=self.args[0]) + return context + class UsersXLSExport(object): - def __init__(self): - self.first_row = 1 - self.book = Workbook() - self.sheet = self.book.add_sheet('Etudiants') - row = self.sheet.row(0) - row.write(0, 'NOM') - row.write(1, 'PRENOM') - row.write(2, 'IEJ') - row.write(3, 'FORMATION') - row.write(4, 'PROC') - row.write(5, 'Ecrit Spe') - row.write(6, unicode('Oral Spe')) - row.write(7, 'ORAL 1') - row.write(8, 'ORAL 2') - row.write(9, 'MAIL') - row.write(10, 'ADRESSE') - row.write(11, 'CP') - row.write(12, 'VILLE') - row.write(13, 'TEL') - row.write(14, "Date d'inscription") - row.write(15, "Categorie") + first_row = 2 def export_user(self, count, user): student = Student.objects.filter(user=user) @@ -179,7 +164,6 @@ class UsersXLSExport(object): row.write(6, unicode(student.oral_speciality)) row.write(7, unicode(student.oral_1)) row.write(8, unicode(student.oral_2)) - row.write(15, unicode(student.category)) profile = Profile.objects.filter(user=user) if profile: @@ -194,29 +178,40 @@ class UsersXLSExport(object): @method_decorator(permission_required('is_superuser')) def export(self, request): - users = User.objects.all() + self.book = Workbook() + self.sheet = self.book.add_sheet('Etudiants') + row = self.sheet.row(0) + row.write(0, 'NOM') + row.write(1, 'PRENOM') + row.write(2, 'IEJ') + row.write(3, 'FORMATION') + row.write(4, 'PROC') + row.write(5, 'Ecrit Spe') + row.write(6, unicode('Oral Spe')) + row.write(7, 'ORAL 1') + row.write(8, 'ORAL 2') + row.write(9, 'MAIL') + row.write(10, 'ADRESSE') + row.write(11, 'CP') + row.write(12, 'VILLE') + row.write(13, 'TEL') + row.write(14, "Date d'inscription") count = self.first_row - for user in users: + for user in self.users: self.export_user(count, user) count += 1 - response = HttpResponse(mimetype="application/vnd.ms-excel") response['Content-Disposition'] = 'attachment; filename=users.xls' self.book.save(response) return response @method_decorator(permission_required('is_superuser')) - def export_training(self, request, id): - users = User.objects.all().select_related(depth=2) - trainings = Training.objects.filter(id=id) - users = User.objects.filter(student__training__in=trainings) - - count = self.first_row - for user in users: - self.export_user(count, user) - count += 1 + def all(self, request): + self.users = User.objects.all() + return self.export(request) - response = HttpResponse(mimetype="application/vnd.ms-excel") - response['Content-Disposition'] = 'attachment; filename=users.xls' - self.book.save(response) - return response + @method_decorator(permission_required('is_superuser')) + def by_training(self, request, id): + trainings = Training.objects.filter(id=id) + self.users = User.objects.all().select_related(depth=2).filter(student__training__in=trainings) + return self.export(request)