From ee9e9e7d2d9abe0ee23e13a01f20b31f67eb90ac Mon Sep 17 00:00:00 2001 From: yomguy Date: Wed, 6 Jun 2012 12:37:14 +0200 Subject: [PATCH] fix user XLS export, trans --- teleforma/locale/fr/LC_MESSAGES/django.mo | Bin 4912 -> 4889 bytes teleforma/locale/fr/LC_MESSAGES/django.po | 280 +++++++++--------- .../commands/teleforma-export-users.py | 17 +- .../commands/teleforma-import-users-pb.py | 20 +- .../templates/telemeta/profile_detail.html | 1 + teleforma/templatetags/teleforma_tags.py | 6 + teleforma/views.py | 58 ++-- 7 files changed, 212 insertions(+), 170 deletions(-) diff --git a/teleforma/locale/fr/LC_MESSAGES/django.mo b/teleforma/locale/fr/LC_MESSAGES/django.mo index 0d62673a84749c27aed3cfc5d9a74a85b444c99b..c2884a2fcfc09d932fae6edf23d5d7bf3734ce8b 100644 GIT binary patch delta 2325 zcmZXVTWr)t6o+RE^j@f|pi5=DV(Hc*rG-+YMYIT2XoXUvrApCW{@ZLUyLG#bU`Q8V zC=e49H`tJP!zi_iNp)k?CYX>0qKQWI!DwQdpvHKKB)(YVgYoMV^Hg# zg7Q0V{S#1ro`Gd9<=hK4;Z3MRXUv|3d~S|PC-}_zzlPfAs@cDp{fF6kO!hNg0yQrP z8FID8MyLa9gXQe++H9a3F2(M%2_sOcKWyXUHh#kFNgF>4b;2p@pMlzV7IwqSPzMXr zDSvAqU2ZK*DOF9@(E??+K`m&9e6EX15g#;0pd7@Y?(~S+6Ohk6XZJ zG7IJJqZ0B@+g+wAhhM@x_&wBuA0eOn)%q8p7XAfwhk2#W@i{-0`YWLV4?_i32bKD* z#x|&Voo4SZCI8x}-v)-D0*RY_4C+cwK&5UH>O?O>tvhFY3+m2iVARK(feK_Di^WDL zKP^=9vl}wSb*5;@Q7=@a{bmo_geTw)^p8VjA`Rv6WvD>UL7nt{>%Rn*;!mOGUxC-b zZ=nLeX7&P922(}Uau9$@O&H3-dZ>*y8k^yA>{h7x-S8&pL9H8y+Tb|UL7s)0cgE}~ z$mia%{)>7{@dM-n9JWI_?1sufFJ!5U zKn3um^*;?2$SJ5Ros_NL|9Kj6^dZ#3OJ;us6~K2;SMm##!)s9U{xlYGe2uR(2BG|| zhWa(tLHTKbd~OSs0_lLO6mbs?u^%e3$DuNEEFH)nNL^2B2^G&en|P2dnz0G3LHA{Q zoEwA>BjpPx+0sVcgc?u>+Ku{j-c_psUeRv0&=FBVkjmj5eyJL^#;(tA?54b`LVs0yicp*v9>dI0sHe~bRCH=-L+ z80q~zf_9->Q4qDD8njv|znew~Rim|N9a349gWC!ZqT9_D^u|>5D|;y0a_-*r>xIV) zcZ?%7^WlZ|^9R9Lqc z>`f{3GAg1Xi*N|(y3n8qi$R1H2nnNzLL$=s=#O6MkD|}_cb}re?|VMyIWNz7&U4Nk zd#V0(ede3!%rT?vLzQT2f!QDgw5aKbqWi?Kg|GvOz&1bz;~@Jr_fAHM`O z|0g&H{s}cdTokO&SUC+oTSRYPL1Wo|dZdDyF=Ht2GDld~Vn;RsYf2cgzK2IcRN z_df^aCkqwG8^L&nlhM#&-wQg-K7xF9mP(PI_x^98HoEBcuWtY4b`g`Kj7Op7)j@`= z$+;Hl03A?)cEh>sZ(DpI4wdR8)WTs+fDgL;w2vQyI@ycf|2ou$C*gKD33Z@(bjn`^ zq{}LyHeTxXa+py^D-A7J2l;FRl_KqNZijNP8!B~!Za)C|>rEQE9vZ>L4vp z8C(bDuhZ?#Q1klS9*B^CZG6B7Qc#gShKl@gw~zSvQK$`Gg&f{;P!7*P1^hA8)l5UB z{ClW*m!LBC8&u$7(k8nUDubD7YAtMrN=-YIgD$8IHadIZeC(Z2^GD!9_z2Xx7oawH z4e9_Vpys{f_J@$q&U*h>keD)dk%kuh0kuJh<0$e4P?WjLRaWO=SL>zR?nW=v zIrgC&(KfUP5v|>e)}!muVx+t%;6-Q?QrVD4kP|hPf&mnl;Uxz37*y^?yX+SJoX}`R z*CCZ|v=QAQgK}#g!6h}(UVvKA4y328vNAgnUYyySH-cJkssUYz^v+bSLMu=^szE9} zXl>BSS9krdtv~zCNOx3^^e&epg0^aO1!_Y}QI*nu1C1r94qby(`jP$xP+5cSLCa)# z+2Xt$-s$a*?AYulbG1b^p@QMz1G)a)Ub&{JEmt+?%~0;MxqYF+-uTc^BDbsbTqs)=tqrGR!>RaCBHJ2m pnU9O9@&CN#o9XPc(WjQAV^iY;spM!PZRru3$@oxmbZXpt?H}7!&aD6d diff --git a/teleforma/locale/fr/LC_MESSAGES/django.po b/teleforma/locale/fr/LC_MESSAGES/django.po index e7d1f5b4..dbe14aa4 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-06-05 20:19+0200\n" +"POT-Creation-Date: 2012-06-06 12:01+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -19,12 +19,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1)\n" #: models.py:69 models.py:81 models.py:99 models.py:111 models.py:166 -#: models.py:291 models.py:383 models.py:399 +#: models.py:292 models.py:384 models.py:400 msgid "name" msgstr "nom" #: models.py:70 models.py:82 models.py:100 models.py:112 models.py:125 -#: models.py:167 models.py:221 models.py:273 models.py:292 models.py:384 +#: models.py:167 models.py:222 models.py:274 models.py:293 models.py:385 msgid "description" msgstr "description" @@ -36,23 +36,23 @@ msgstr "organisation" msgid "department" msgstr "département" -#: models.py:107 models.py:400 models.py:445 +#: models.py:107 models.py:401 models.py:446 msgid "period" msgstr "période" -#: models.py:119 models.py:180 models.py:240 models.py:307 models.py:354 +#: models.py:119 models.py:180 models.py:241 models.py:308 models.py:355 msgid "course type" msgstr "type de matière" -#: models.py:124 models.py:272 +#: models.py:124 models.py:273 msgid "title" msgstr "titre" -#: models.py:126 models.py:277 models.py:398 +#: models.py:126 models.py:278 models.py:399 msgid "code" msgstr "cote" -#: models.py:127 models.py:276 +#: models.py:127 models.py:277 msgid "date modified" msgstr "date de modification" @@ -60,23 +60,23 @@ msgstr "date de modification" msgid "number" msgstr "" -#: models.py:129 models.py:403 models.py:450 +#: models.py:129 models.py:404 msgid "synthesis note" msgstr "note de synthèse" -#: models.py:130 -msgid "obligation" -msgstr "obligation" +#: models.py:130 models.py:407 +msgid "obligations" +msgstr "obligations" -#: models.py:143 models.py:179 models.py:238 models.py:306 models.py:353 +#: models.py:143 models.py:179 models.py:239 models.py:307 models.py:354 msgid "course" msgstr "matière" -#: models.py:149 models.py:444 models.py:486 +#: models.py:149 models.py:445 models.py:483 msgid "user" msgstr "utilisateur" -#: models.py:151 models.py:439 models.py:447 +#: models.py:150 models.py:440 models.py:450 msgid "training" msgstr "formation" @@ -88,200 +88,184 @@ msgstr "matières" msgid "professor" msgstr "professeur" -#: models.py:174 models.py:184 +#: models.py:174 models.py:185 msgid "room" msgstr "salle" -#: models.py:182 +#: models.py:183 msgid "session" msgstr "session" -#: models.py:186 +#: models.py:187 msgid "comment" msgstr "" -#: models.py:187 +#: models.py:188 msgid "begin date" msgstr "date de début" -#: models.py:188 +#: models.py:189 msgid "end date" msgstr "date de fin" -#: models.py:189 models.py:359 +#: models.py:190 models.py:360 msgid "is live" msgstr "en direct" -#: models.py:190 models.py:314 models.py:360 +#: models.py:191 models.py:315 models.py:361 msgid "readers" msgstr "" -#: models.py:210 models.py:242 models.py:308 models.py:355 +#: models.py:211 models.py:243 models.py:309 models.py:356 msgid "conference" msgstr "conférence" -#: models.py:218 +#: models.py:219 msgid "host" msgstr "" -#: models.py:219 +#: models.py:220 msgid "port" msgstr "" -#: models.py:220 models.py:310 +#: models.py:221 models.py:311 msgid "type" msgstr "type" -#: models.py:222 +#: models.py:223 msgid "source password" msgstr "" -#: models.py:223 +#: models.py:224 msgid "admin password" msgstr "" -#: models.py:230 models.py:245 +#: models.py:231 models.py:246 msgid "streaming server" msgstr "serveur de diffusion" -#: models.py:246 +#: models.py:247 msgid "Streaming type" msgstr "Type de flux" -#: models.py:266 +#: models.py:267 msgid "live stream" msgstr "stream en direct" -#: models.py:274 +#: models.py:275 msgid "credits" msgstr "crédits" -#: models.py:275 models.py:506 +#: models.py:276 models.py:503 msgid "date added" msgstr "date d'ajout" -#: models.py:278 +#: models.py:279 msgid "published" msgstr "publié" -#: models.py:299 +#: models.py:300 msgid "document type" msgstr "type de document" -#: models.py:312 +#: models.py:313 msgid "annal" msgstr "annale" -#: models.py:313 +#: models.py:314 msgid "file" msgstr "fichier" -#: models.py:391 models.py:392 templates/telemeta/profile_detail.html:61 +#: models.py:392 models.py:393 templates/telemeta/profile_detail.html:63 #: templates/telemeta/users.html:29 templates/telemeta/inc/user_list.html:21 msgid "IEJ" msgstr "IEJ" -#: models.py:406 models.py:453 -msgid "obligations" -msgstr "obligations" - -#: models.py:409 +#: models.py:410 models.py:453 msgid "procedure" msgstr "procédure" -#: models.py:412 +#: models.py:413 models.py:459 msgid "written speciality" msgstr "spécialité écrit" -#: models.py:415 +#: models.py:416 models.py:456 msgid "oral speciality" msgstr "spécialité orale" -#: models.py:418 models.py:421 models.py:464 +#: models.py:419 models.py:422 models.py:461 msgid "oral 1" msgstr "" -#: models.py:424 models.py:468 +#: models.py:425 models.py:465 msgid "options" msgstr "options" -#: models.py:427 +#: models.py:428 msgid "magitral courses" msgstr "Cours magistraux" -#: models.py:429 +#: models.py:430 msgid "cost" msgstr "coût" -#: models.py:446 +#: models.py:448 msgid "iej" msgstr "iej" -#: models.py:448 +#: models.py:451 msgid "platform only" -msgstr "" - -#: models.py:456 -msgid "procedures" -msgstr "procédures" - -#: models.py:459 -msgid "oral specialities" -msgstr "spécialités orales" +msgstr "plateforme seulement" -#: models.py:462 -msgid "written specialities" -msgstr "spécialités écrites" - -#: models.py:466 +#: models.py:463 msgid "oral 2" msgstr "" -#: models.py:479 models.py:504 +#: models.py:476 models.py:501 msgid "student" msgstr "étudiant" -#: models.py:487 templates/telemeta/profile_detail.html:72 +#: models.py:484 templates/telemeta/profile_detail.html:76 msgid "Address" msgstr "" -#: models.py:488 +#: models.py:485 msgid "Postal code" msgstr "Code postal" -#: models.py:489 +#: models.py:486 msgid "City" msgstr "Ville" -#: models.py:490 +#: models.py:487 msgid "Country" msgstr "Pays" -#: models.py:491 templates/telemeta/profile_detail.html:81 +#: models.py:488 templates/telemeta/profile_detail.html:85 msgid "Language" msgstr "Langue" -#: models.py:492 templates/telemeta/profile_detail.html:73 +#: models.py:489 templates/telemeta/profile_detail.html:77 msgid "Telephone" msgstr "Téléphone" -#: models.py:493 +#: models.py:490 msgid "Expiration_date" msgstr "Date d'expiration" -#: models.py:494 +#: models.py:491 msgid "Password initialization" msgstr "" -#: models.py:498 +#: models.py:495 msgid "profile" msgstr "profil" -#: models.py:505 +#: models.py:502 msgid "amount" msgstr "montant" -#: models.py:514 +#: models.py:511 msgid "payment" msgstr "paiement" @@ -499,7 +483,7 @@ msgstr "" msgid "Conversation" msgstr "" -#: templates/postman/view.html:9 templates/telemeta/inc/user_list.html:67 +#: templates/postman/view.html:9 templates/telemeta/inc/user_list.html:69 #, fuzzy msgid "Message" msgstr "Messages" @@ -516,34 +500,31 @@ msgstr "" msgid "Back" msgstr "" -#: templates/postman/write.html:3 templates/telemeta/inc/user_list.html:27 +#: templates/postman/write.html:3 templates/telemeta/inc/user_list.html:28 msgid "Write" msgstr "" #: templates/teleforma/course.html:15 -#: templates/teleforma/inc/document_list.html:6 +#: templates/teleforma/inc/document_list.html:7 msgid "Documents" msgstr "Supports écrits" #: templates/teleforma/course.html:18 templates/teleforma/course.html.py:34 #: templates/teleforma/course_conference.html:33 #: templates/teleforma/course_document.html:68 -#: templates/teleforma/inc/document_list.html:11 -#: templates/teleforma/inc/media_list.html:11 templates/telemeta/lists.html:69 -#: templates/telemeta/search_criteria.html:97 +#: templates/teleforma/inc/document_list.html:12 +#: templates/telemeta/lists.html:69 templates/telemeta/search_criteria.html:97 #: templates/telemeta/inc/module_revisions.html:17 msgid "Title" msgstr "Titre" #: templates/teleforma/course.html:19 templates/teleforma/course.html.py:35 -#: templates/teleforma/inc/document_list.html:12 -#: templates/teleforma/inc/media_list.html:12 msgid "Description" msgstr "Description" #: templates/teleforma/course.html:20 templates/teleforma/course.html.py:36 #: templates/teleforma/course.html:53 templates/teleforma/course_media.html:62 -#: templates/telemeta/profile_detail.html:76 +#: templates/telemeta/profile_detail.html:80 msgid "Date added" msgstr "Date d'ajout" @@ -557,15 +538,17 @@ msgstr "Conférences" #: templates/teleforma/course.html:51 #: templates/teleforma/course_conference.html:34 -#: templates/teleforma/inc/conference_list.html:13 +#: templates/teleforma/inc/conference_list.html:12 +#: templates/teleforma/inc/media_list.html:12 msgid "Session" msgstr "Session" #: templates/teleforma/course.html:52 #: templates/teleforma/course_conference.html:35 #: templates/teleforma/course_media.html:51 -#: templates/teleforma/inc/conference_list.html:14 -#: templates/telemeta/inc/user_list.html:46 +#: templates/teleforma/inc/conference_list.html:13 +#: templates/teleforma/inc/media_list.html:13 +#: templates/telemeta/inc/user_list.html:48 msgid "Professor" msgstr "Professeur" @@ -581,13 +564,9 @@ msgstr "Fin" msgid "Live" msgstr "Direct" -#: templates/teleforma/course_detail.html:50 -#: templates/teleforma/courses.html:83 -msgid "No document" -msgstr "Aucun document" - #: templates/teleforma/course_media.html:57 -#: templates/teleforma/inc/conference_list.html:15 +#: templates/teleforma/inc/conference_list.html:14 +#: templates/teleforma/inc/media_list.html:14 msgid "Begin date" msgstr "Date de début" @@ -604,29 +583,19 @@ msgstr "Type mime" msgid "My courses" msgstr "Mes matières" -#: templates/teleforma/courses.html:36 +#: templates/teleforma/courses.html:38 msgid "My notes" msgstr "Mes notes" -#: templates/teleforma/courses.html:46 +#: templates/teleforma/courses.html:48 msgid "New note" msgstr "Nouvelle note" -#: templates/teleforma/inc/conference_list.html:6 +#: templates/teleforma/inc/conference_list.html:7 msgid "Live conference" msgstr "Conférence en direct" -#: templates/teleforma/inc/conference_list.html:11 -#: templates/telemeta/lists.html:70 -#: templates/telemeta/inc/module_revisions.html:18 -msgid "Type" -msgstr "" - -#: templates/teleforma/inc/conference_list.html:12 -msgid "Room" -msgstr "Salle" - -#: templates/teleforma/inc/conference_list.html:16 +#: templates/teleforma/inc/conference_list.html:15 msgid "Streaming" msgstr "Diffusion" @@ -635,7 +604,6 @@ msgid "Annal" msgstr "Annale" #: templates/teleforma/inc/document_list.html:14 -#: templates/teleforma/inc/media_list.html:13 msgid "Date modified" msgstr "Date de modification" @@ -643,10 +611,18 @@ msgstr "Date de modification" msgid "Download" msgstr "Télécharger" -#: templates/teleforma/inc/media_list.html:6 +#: templates/teleforma/inc/document_list.html:37 +msgid "No document" +msgstr "Aucun document" + +#: templates/teleforma/inc/media_list.html:7 msgid "Passed conferences" msgstr "Conférences passées" +#: templates/teleforma/inc/media_list.html:15 +msgid "Duration" +msgstr "Durée" + #: templates/telemeta/base.html:68 msgid "Desk" msgstr "Bureau" @@ -720,23 +696,26 @@ msgstr "" msgid "Add" msgstr "" -#: templates/telemeta/lists.html:55 templates/telemeta/profile_detail.html:47 +#: templates/telemeta/lists.html:55 templates/telemeta/profile_detail.html:49 msgid "Edit" msgstr "" +#: templates/telemeta/lists.html:70 +#: templates/telemeta/inc/module_revisions.html:18 +msgid "Type" +msgstr "" + #: templates/telemeta/lists.html:71 msgid "Code" msgstr "" #: templates/telemeta/lists.html:72 -#, fuzzy msgid "Recordist" -msgstr "date de d'enregistrement" +msgstr "Opérateur d'enregistrement" #: templates/telemeta/lists.html:73 -#, fuzzy msgid "Recording period" -msgstr "date de d'enregistrement" +msgstr "période d'enregistrement" #: templates/telemeta/lists.html:74 #: templates/telemeta/search_criteria.html:149 @@ -757,81 +736,91 @@ msgstr "profil" msgid "His courses" msgstr "Ses matières" -#: templates/telemeta/profile_detail.html:34 +#: templates/telemeta/profile_detail.html:36 msgid "Send a message" msgstr "Envoyer un message" -#: templates/telemeta/profile_detail.html:42 +#: templates/telemeta/profile_detail.html:44 #, fuzzy msgid "User profile" msgstr "profil" -#: templates/telemeta/profile_detail.html:48 +#: templates/telemeta/profile_detail.html:50 msgid "Change password" msgstr "" -#: templates/telemeta/profile_detail.html:56 +#: templates/telemeta/profile_detail.html:58 #: templates/telemeta/inc/user_list.html:20 msgid "First Name" msgstr "" -#: templates/telemeta/profile_detail.html:57 +#: templates/telemeta/profile_detail.html:59 #: templates/telemeta/inc/user_list.html:19 msgid "Last Name" msgstr "" -#: templates/telemeta/profile_detail.html:58 +#: templates/telemeta/profile_detail.html:60 #, fuzzy msgid "Username" msgstr "nom" -#: templates/telemeta/profile_detail.html:62 +#: templates/telemeta/profile_detail.html:64 msgid "Training" msgstr "Formation" -#: templates/telemeta/profile_detail.html:63 +#: templates/telemeta/profile_detail.html:65 +msgid "Platform only" +msgstr "" + +#: templates/telemeta/profile_detail.html:66 #: templates/telemeta/inc/user_list.html:22 msgid "Procedure" msgstr "Procédure" -#: templates/telemeta/profile_detail.html:64 +#: templates/telemeta/profile_detail.html:67 #: templates/telemeta/inc/user_list.html:23 msgid "Oral spe" msgstr "Oral Spé" -#: templates/telemeta/profile_detail.html:65 +#: templates/telemeta/profile_detail.html:68 #: templates/telemeta/inc/user_list.html:24 msgid "Written spe" msgstr "Ecrit Spé" -#: templates/telemeta/profile_detail.html:66 +#: templates/telemeta/profile_detail.html:69 #: templates/telemeta/inc/user_list.html:25 msgid "Oral 1" msgstr "" -#: templates/telemeta/profile_detail.html:67 +#: templates/telemeta/profile_detail.html:70 #: templates/telemeta/inc/user_list.html:26 msgid "Oral 2" msgstr "" #: templates/telemeta/profile_detail.html:71 +#: templates/telemeta/inc/user_list.html:27 +#, fuzzy +msgid "Options" +msgstr "options" + +#: templates/telemeta/profile_detail.html:75 msgid "Email" msgstr "" -#: templates/telemeta/profile_detail.html:77 +#: templates/telemeta/profile_detail.html:81 #, fuzzy msgid "Expiration date" msgstr "Date d'expiration" -#: templates/telemeta/profile_detail.html:78 +#: templates/telemeta/profile_detail.html:82 msgid "Last login" msgstr "" -#: templates/telemeta/profile_detail.html:89 +#: templates/telemeta/profile_detail.html:93 msgid "Apply" msgstr "" -#: templates/telemeta/profile_detail.html:99 +#: templates/telemeta/profile_detail.html:103 msgid "Login as" msgstr "Se connecter en tant que" @@ -879,11 +868,11 @@ msgstr "" msgid "Criteria" msgstr "" -#: templates/telemeta/inc/user_list.html:53 +#: templates/telemeta/inc/user_list.html:55 msgid "Administrator" msgstr "" -#: templates/telemeta/inc/user_list.html:60 +#: templates/telemeta/inc/user_list.html:62 msgid "Unknown" msgstr "" @@ -899,6 +888,29 @@ msgstr "Tweeter local" msgid "me" msgstr "moi" +#: templatetags/teleforma_tags.py:98 +msgid "Yes" +msgstr "" + +#: templatetags/teleforma_tags.py:100 +msgid "No" +msgstr "" + +#~ msgid "obligation" +#~ msgstr "obligation" + +#~ msgid "procedures" +#~ msgstr "procédures" + +#~ msgid "oral specialities" +#~ msgstr "spécialités orales" + +#~ msgid "written specialities" +#~ msgstr "spécialités écrites" + +#~ msgid "Room" +#~ msgstr "Salle" + #~ msgid "Differed" #~ msgstr "Différé" diff --git a/teleforma/management/commands/teleforma-export-users.py b/teleforma/management/commands/teleforma-export-users.py index 5ada83df..46ce32ba 100644 --- a/teleforma/management/commands/teleforma-export-users.py +++ b/teleforma/management/commands/teleforma-export-users.py @@ -26,13 +26,16 @@ class Command(BaseCommand): row.write(1, user.first_name) row.write(9, user.email) row.write(2, unicode(student.iej)) - row.write(3, unicode(student.training.code)) - row.write(4, unicode(student.procedure)) - row.write(5, unicode(student.written_speciality)) - 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)) + code = student.training.code + if student.platform_only: + code = 'I - ' + code + row.write(3, unicode(code)) + row.write(4, unicode(student.procedure.code)) + row.write(5, unicode(student.written_speciality.code)) + row.write(6, unicode(student.oral_speciality.code)) + row.write(7, unicode(student.oral_1.code)) + row.write(8, unicode(student.oral_2.code)) + row.write(15, unicode(student.period)) profile = Profile.objects.filter(user=user) if profile: diff --git a/teleforma/management/commands/teleforma-import-users-pb.py b/teleforma/management/commands/teleforma-import-users-pb.py index 58d2fe87..a914da8f 100644 --- a/teleforma/management/commands/teleforma-import-users-pb.py +++ b/teleforma/management/commands/teleforma-import-users-pb.py @@ -34,6 +34,16 @@ class Command(BaseCommand): training = Training.objects.get(code=code) return platform_only, training + def get_iej(self, name): + iejs = IEJ.objects.filter(name=name) + if iejs: + iej = iejs[0] + elif not name: + iej = None + else: + iej, c = IEJ.objects.get_or_create(name=name) + return iej + def import_user(self, row): last_name = row[0].value first_name = row[1].value @@ -57,15 +67,9 @@ class Command(BaseCommand): student = Student.objects.filter(user=user) if not student: student = Student(user=user) - student.platform_only, student.training = self.get_training(code=row[3].value) + student.platform_only, student.training = self.get_training(row[3].value) student.period = Period.objects.get(name='Estivale') - name = row[2].value - iejs = IEJ.objects.filter(name=name) - if iejs: - iej = iejs[0] - else: - iej = None - student.iej = iej + student.iej = self.get_iej(row[2].value) student.save() student.procedure = self.get_courses(row[4].value) diff --git a/teleforma/templates/telemeta/profile_detail.html b/teleforma/templates/telemeta/profile_detail.html index b4890d26..8a7eb6ca 100644 --- a/teleforma/templates/telemeta/profile_detail.html +++ b/teleforma/templates/telemeta/profile_detail.html @@ -62,6 +62,7 @@ {% if usr.student.get %}
{% trans "IEJ" %}
{{ usr.student.get.iej }}
{% trans "Training" %}
{{ usr.student.get.training }}
+
{% trans "Platform only" %}
{{ usr.student.get.platform_only|yes_no }}
{% trans "Procedure"%}
{{ usr.student.get.procedure}}
{% trans "Oral spe"%}
{{ usr.student.get.oral_speciality }}
{% trans "Written spe"%}
{{ usr.student.get.written_speciality }}
diff --git a/teleforma/templatetags/teleforma_tags.py b/teleforma/templatetags/teleforma_tags.py index cce6aa6a..2c0ad4eb 100644 --- a/teleforma/templatetags/teleforma_tags.py +++ b/teleforma/templatetags/teleforma_tags.py @@ -92,3 +92,9 @@ def or_me(value, arg): arg = unicode(arg) return _('me') if value == arg else value +@register.filter +def yes_no(bool): + if bool: + return _('Yes') + else: + return _('No') diff --git a/teleforma/views.py b/teleforma/views.py index 72d7e473..4dfda661 100755 --- a/teleforma/views.py +++ b/teleforma/views.py @@ -338,6 +338,11 @@ class UsersCourseView(UsersView): def dispatch(self, *args, **kwargs): return super(UsersCourseView, self).dispatch(*args, **kwargs) +def get_course_code(obj): + if obj: + return unicode(obj.code) + else: + return '' class UsersXLSExport(object): @@ -352,12 +357,15 @@ class UsersXLSExport(object): row.write(1, user.first_name) row.write(9, user.email) row.write(2, unicode(student.iej)) - row.write(3, unicode(student.training.code)) - row.write(4, unicode(student.procedure)) - row.write(5, unicode(student.written_speciality)) - row.write(6, unicode(student.oral_speciality)) - row.write(7, unicode(student.oral_1)) - row.write(8, unicode(student.oral_2)) + code = student.training.code + if student.platform_only: + code = 'I - ' + code + row.write(3, unicode(code)) + row.write(4, get_course_code(student.procedure)) + row.write(5, get_course_code(student.written_speciality)) + row.write(6, get_course_code(student.oral_speciality)) + row.write(7, get_course_code(student.oral_1)) + row.write(8, get_course_code(student.oral_2)) profile = Profile.objects.filter(user=user) if profile: @@ -376,22 +384,30 @@ class UsersXLSExport(object): self.users = self.users.order_by('last_name') 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, '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") + cols = [{'name':'NOM', 'width':5000}, + {'name':'PRENOM', 'width':5000}, + {'name':'IEJ', 'width':2500}, + {'name':'FORMATION', 'width':5000}, + {'name':'PROC', 'width':2500}, + {'name':'Ecrit Spe', 'width':2500}, + {'name':'Oral Spe', 'width':2500}, + {'name':'ORAL 1', 'width':2500}, + {'name':'ORAL 2', 'width':2500}, + {'name':'MAIL', 'width':7500}, + {'name':'ADRESSE', 'width':7500}, + {'name':'CP', 'width':2500}, + {'name':'VILLE', 'width':5000}, + {'name':'TEL', 'width':5000}, + {'name':"Date d'inscription", 'width':5000} + ] + i = 0 + for col in cols: + row.write(i, col['name']) + self.sheet.col(i).width = col['width'] + i += 1 + counter = 0 for user in self.users: counter = self.export_user(counter, user) -- 2.39.5