pedagogy: add script to remove all previous doubled comments

This commit is contained in:
Antoine Bartuccio 2019-09-04 20:49:17 +02:00
parent ca042fe75e
commit a69f7b12b1
Signed by: klmp200
GPG Key ID: E7245548C53F904B
7 changed files with 215 additions and 124 deletions

View File

@ -1867,6 +1867,13 @@ $pedagogy-white-text: #f0f0f0;
grid-area: hours-the; grid-area: hours-the;
} }
#leave_comment_not_allowed {
p {
text-align: center;
color: red;
}
}
#leave_comment { #leave_comment {
.leave-comment-grid-container { .leave-comment-grid-container {
display: grid; display: grid;

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-08-17 18:22+0200\n" "POT-Creation-Date: 2019-09-04 20:43+0200\n"
"PO-Revision-Date: 2016-07-18\n" "PO-Revision-Date: 2016-07-18\n"
"Last-Translator: Skia <skia@libskia.so>\n" "Last-Translator: Skia <skia@libskia.so>\n"
"Language-Team: AE info <ae.info@utbm.fr>\n" "Language-Team: AE info <ae.info@utbm.fr>\n"
@ -17,8 +17,8 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: accounting/models.py:61 accounting/models.py:110 accounting/models.py:138 #: accounting/models.py:61 accounting/models.py:110 accounting/models.py:138
#: accounting/models.py:203 club/models.py:48 com/models.py:231 #: accounting/models.py:203 club/models.py:48 com/models.py:230
#: com/models.py:248 counter/models.py:121 counter/models.py:149 #: com/models.py:247 counter/models.py:121 counter/models.py:149
#: counter/models.py:211 forum/models.py:58 launderette/models.py:38 #: counter/models.py:211 forum/models.py:58 launderette/models.py:38
#: launderette/models.py:90 launderette/models.py:125 stock/models.py:40 #: launderette/models.py:90 launderette/models.py:125 stock/models.py:40
#: stock/models.py:60 stock/models.py:100 stock/models.py:127 #: stock/models.py:60 stock/models.py:100 stock/models.py:127
@ -66,7 +66,7 @@ msgid "account number"
msgstr "numero de compte" msgstr "numero de compte"
#: accounting/models.py:113 accounting/models.py:139 club/models.py:266 #: accounting/models.py:113 accounting/models.py:139 club/models.py:266
#: com/models.py:75 com/models.py:219 com/models.py:252 counter/models.py:166 #: com/models.py:74 com/models.py:218 com/models.py:251 counter/models.py:166
#: counter/models.py:212 trombi/models.py:205 #: counter/models.py:212 trombi/models.py:205
msgid "club" msgid "club"
msgstr "club" msgstr "club"
@ -136,7 +136,7 @@ msgid "date"
msgstr "date" msgstr "date"
#: accounting/models.py:270 counter/models.py:123 counter/models.py:616 #: accounting/models.py:270 counter/models.py:123 counter/models.py:616
#: pedagogy/models.py:204 stock/models.py:102 #: pedagogy/models.py:215 stock/models.py:102
msgid "comment" msgid "comment"
msgstr "commentaire" msgstr "commentaire"
@ -377,10 +377,10 @@ msgstr "Compte en banque : "
#: election/templates/election/election_detail.jinja:401 #: election/templates/election/election_detail.jinja:401
#: forum/templates/forum/macros.jinja:21 forum/templates/forum/macros.jinja:134 #: forum/templates/forum/macros.jinja:21 forum/templates/forum/macros.jinja:134
#: launderette/templates/launderette/launderette_admin.jinja:16 #: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:226 pedagogy/templates/pedagogy/guide.jinja:51 #: launderette/views.py:226 pedagogy/templates/pedagogy/guide.jinja:67
#: pedagogy/templates/pedagogy/guide.jinja:74 #: pedagogy/templates/pedagogy/guide.jinja:90
#: pedagogy/templates/pedagogy/guide.jinja:110 #: pedagogy/templates/pedagogy/guide.jinja:126
#: pedagogy/templates/pedagogy/uv_detail.jinja:179 #: pedagogy/templates/pedagogy/uv_detail.jinja:185
#: sas/templates/sas/album.jinja:26 sas/templates/sas/moderation.jinja:18 #: sas/templates/sas/album.jinja:26 sas/templates/sas/moderation.jinja:18
#: sas/templates/sas/picture.jinja:74 sas/templates/sas/picture.jinja:124 #: sas/templates/sas/picture.jinja:74 sas/templates/sas/picture.jinja:124
#: stock/templates/stock/stock_shopping_list.jinja:43 #: stock/templates/stock/stock_shopping_list.jinja:43
@ -436,10 +436,10 @@ msgstr "Nouveau compte club"
#: forum/templates/forum/macros.jinja:20 forum/templates/forum/macros.jinja:62 #: forum/templates/forum/macros.jinja:20 forum/templates/forum/macros.jinja:62
#: forum/templates/forum/macros.jinja:128 #: forum/templates/forum/macros.jinja:128
#: launderette/templates/launderette/launderette_list.jinja:16 #: launderette/templates/launderette/launderette_list.jinja:16
#: pedagogy/templates/pedagogy/guide.jinja:50 #: pedagogy/templates/pedagogy/guide.jinja:66
#: pedagogy/templates/pedagogy/guide.jinja:73 #: pedagogy/templates/pedagogy/guide.jinja:89
#: pedagogy/templates/pedagogy/guide.jinja:109 #: pedagogy/templates/pedagogy/guide.jinja:125
#: pedagogy/templates/pedagogy/uv_detail.jinja:178 #: pedagogy/templates/pedagogy/uv_detail.jinja:184
#: sas/templates/sas/album.jinja:18 sas/templates/sas/picture.jinja:100 #: sas/templates/sas/album.jinja:18 sas/templates/sas/picture.jinja:100
#: trombi/templates/trombi/detail.jinja:9 #: trombi/templates/trombi/detail.jinja:9
#: trombi/templates/trombi/edit_profile.jinja:34 #: trombi/templates/trombi/edit_profile.jinja:34
@ -670,7 +670,7 @@ msgstr "Effectuées"
#: accounting/templates/accounting/journal_details.jinja:41 #: accounting/templates/accounting/journal_details.jinja:41
#: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:1162 #: counter/templates/counter/cash_summary_list.jinja:37 counter/views.py:1162
#: pedagogy/templates/pedagogy/moderation.jinja:13 #: pedagogy/templates/pedagogy/moderation.jinja:13
#: pedagogy/templates/pedagogy/uv_detail.jinja:133 #: pedagogy/templates/pedagogy/uv_detail.jinja:138
#: trombi/templates/trombi/comment.jinja:4 #: trombi/templates/trombi/comment.jinja:4
#: trombi/templates/trombi/comment.jinja:8 #: trombi/templates/trombi/comment.jinja:8
#: trombi/templates/trombi/user_tools.jinja:50 #: trombi/templates/trombi/user_tools.jinja:50
@ -968,7 +968,7 @@ msgstr "vous devez spécifier au moins un utilisateur ou une adresse email"
msgid "Begin date" msgid "Begin date"
msgstr "Date de début" msgstr "Date de début"
#: club/forms.py:169 com/views.py:85 com/views.py:221 counter/views.py:1558 #: club/forms.py:169 com/views.py:85 com/views.py:210 counter/views.py:1558
#: election/views.py:190 subscription/views.py:52 #: election/views.py:190 subscription/views.py:52
msgid "End date" msgid "End date"
msgstr "Date de fin" msgstr "Date de fin"
@ -1077,11 +1077,11 @@ msgid "Enter a valid address. Only the root of the address is needed."
msgstr "" msgstr ""
"Entrez une adresse valide. Seule la racine de l'adresse est nécessaire." "Entrez une adresse valide. Seule la racine de l'adresse est nécessaire."
#: club/models.py:335 com/models.py:79 com/models.py:260 core/models.py:814 #: club/models.py:335 com/models.py:78 com/models.py:259 core/models.py:814
msgid "is moderated" msgid "is moderated"
msgstr "est modéré" msgstr "est modéré"
#: club/models.py:337 com/models.py:81 com/models.py:264 #: club/models.py:337 com/models.py:80 com/models.py:263
msgid "moderator" msgid "moderator"
msgstr "modérateur" msgstr "modérateur"
@ -1246,7 +1246,7 @@ msgid "Payment method"
msgstr "Méthode de paiement" msgstr "Méthode de paiement"
#: club/templates/club/club_tools.jinja:4 #: club/templates/club/club_tools.jinja:4
#: core/templates/core/user_tools.jinja:101 #: core/templates/core/user_tools.jinja:100
msgid "Club tools" msgid "Club tools"
msgstr "Outils club" msgstr "Outils club"
@ -1273,7 +1273,7 @@ msgstr "Nouveau Trombi"
#: club/templates/club/club_tools.jinja:14 #: club/templates/club/club_tools.jinja:14
#: com/templates/com/poster_list.jinja:17 #: com/templates/com/poster_list.jinja:17
#: core/templates/core/poster_list.jinja:17 #: core/templates/core/poster_list.jinja:17
#: core/templates/core/user_tools.jinja:91 #: core/templates/core/user_tools.jinja:90
msgid "Posters" msgid "Posters"
msgstr "Affiches" msgstr "Affiches"
@ -1376,7 +1376,7 @@ msgstr "Éditer la page de club"
msgid "Mailing list" msgid "Mailing list"
msgstr "Listes de diffusion" msgstr "Listes de diffusion"
#: club/views.py:160 com/views.py:141 #: club/views.py:160 com/views.py:138
msgid "Posters list" msgid "Posters list"
msgstr "Liste d'affiches" msgstr "Liste d'affiches"
@ -1400,108 +1400,104 @@ msgid "info message"
msgstr "message d'info" msgstr "message d'info"
#: com/models.py:48 #: com/models.py:48
msgid "index page"
msgstr "page d'accueil"
#: com/models.py:49
msgid "weekmail destinations" msgid "weekmail destinations"
msgstr "destinataires du weekmail" msgstr "destinataires du weekmail"
#: com/models.py:59 #: com/models.py:58
msgid "Notice" msgid "Notice"
msgstr "Information" msgstr "Information"
#: com/models.py:60 #: com/models.py:59
msgid "Event" msgid "Event"
msgstr "Événement" msgstr "Événement"
#: com/models.py:61 #: com/models.py:60
msgid "Weekly" msgid "Weekly"
msgstr "Hebdomadaire" msgstr "Hebdomadaire"
#: com/models.py:62 #: com/models.py:61
msgid "Call" msgid "Call"
msgstr "Appel" msgstr "Appel"
#: com/models.py:69 com/models.py:155 com/models.py:213 election/models.py:14 #: com/models.py:68 com/models.py:154 com/models.py:212 election/models.py:14
#: election/models.py:116 election/models.py:156 forum/models.py:242 #: election/models.py:116 election/models.py:156 forum/models.py:242
#: forum/models.py:296 pedagogy/models.py:100 #: forum/models.py:296 pedagogy/models.py:100
msgid "title" msgid "title"
msgstr "titre" msgstr "titre"
#: com/models.py:70 #: com/models.py:69
msgid "summary" msgid "summary"
msgstr "résumé" msgstr "résumé"
#: com/models.py:71 com/models.py:214 trombi/models.py:188 #: com/models.py:70 com/models.py:213 trombi/models.py:188
msgid "content" msgid "content"
msgstr "contenu" msgstr "contenu"
#: com/models.py:73 core/models.py:1393 launderette/models.py:95 #: com/models.py:72 core/models.py:1393 launderette/models.py:95
#: launderette/models.py:130 launderette/models.py:182 stock/models.py:77 #: launderette/models.py:130 launderette/models.py:182 stock/models.py:77
#: stock/models.py:131 #: stock/models.py:131
msgid "type" msgid "type"
msgstr "type" msgstr "type"
#: com/models.py:77 com/models.py:216 pedagogy/models.py:61 #: com/models.py:76 com/models.py:215 pedagogy/models.py:61
#: pedagogy/models.py:199 trombi/models.py:183 #: pedagogy/models.py:210 trombi/models.py:183
msgid "author" msgid "author"
msgstr "auteur" msgstr "auteur"
#: com/models.py:142 #: com/models.py:141
msgid "news_date" msgid "news_date"
msgstr "date de la nouvelle" msgstr "date de la nouvelle"
#: com/models.py:143 #: com/models.py:142
msgid "start_date" msgid "start_date"
msgstr "date de début" msgstr "date de début"
#: com/models.py:144 #: com/models.py:143
msgid "end_date" msgid "end_date"
msgstr "date de fin" msgstr "date de fin"
#: com/models.py:156 #: com/models.py:155
msgid "intro" msgid "intro"
msgstr "intro" msgstr "intro"
#: com/models.py:157 #: com/models.py:156
msgid "joke" msgid "joke"
msgstr "blague" msgstr "blague"
#: com/models.py:158 #: com/models.py:157
msgid "protip" msgid "protip"
msgstr "astuce" msgstr "astuce"
#: com/models.py:159 #: com/models.py:158
msgid "conclusion" msgid "conclusion"
msgstr "conclusion" msgstr "conclusion"
#: com/models.py:160 #: com/models.py:159
msgid "sent" msgid "sent"
msgstr "envoyé" msgstr "envoyé"
#: com/models.py:211 #: com/models.py:210
msgid "weekmail" msgid "weekmail"
msgstr "weekmail" msgstr "weekmail"
#: com/models.py:221 #: com/models.py:220
msgid "rank" msgid "rank"
msgstr "rang" msgstr "rang"
#: com/models.py:250 core/models.py:784 core/models.py:828 #: com/models.py:249 core/models.py:784 core/models.py:828
msgid "file" msgid "file"
msgstr "fichier" msgstr "fichier"
#: com/models.py:258 #: com/models.py:257
msgid "display time" msgid "display time"
msgstr "temps d'affichage" msgstr "temps d'affichage"
#: com/models.py:285 #: com/models.py:284
msgid "Begin date should be before end date" msgid "Begin date should be before end date"
msgstr "La date de début doit être avant celle de fin" msgstr "La date de début doit être avant celle de fin"
#: com/templates/com/mailing_admin.jinja:4 com/views.py:134 #: com/templates/com/mailing_admin.jinja:4 com/views.py:131
#: core/templates/core/user_tools.jinja:90 #: core/templates/core/user_tools.jinja:89
msgid "Mailing lists administration" msgid "Mailing lists administration"
msgstr "Administration des mailing listes" msgstr "Administration des mailing listes"
@ -1585,7 +1581,7 @@ msgstr "Type"
#: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48 #: com/templates/com/weekmail.jinja:19 com/templates/com/weekmail.jinja:48
#: forum/templates/forum/forum.jinja:24 forum/templates/forum/forum.jinja:43 #: forum/templates/forum/forum.jinja:24 forum/templates/forum/forum.jinja:43
#: forum/templates/forum/main.jinja:27 forum/views.py:243 #: forum/templates/forum/main.jinja:27 forum/views.py:243
#: pedagogy/templates/pedagogy/guide.jinja:44 #: pedagogy/templates/pedagogy/guide.jinja:60
msgid "Title" msgid "Title"
msgstr "Titre" msgstr "Titre"
@ -1726,24 +1722,24 @@ msgstr "Agenda"
msgid "Birthdays" msgid "Birthdays"
msgstr "Anniversaires" msgstr "Anniversaires"
#: com/templates/com/news_list.jinja:49 #: com/templates/com/news_list.jinja:48
#, python-format #, python-format
msgid "%(age)s year old" msgid "%(age)s year old"
msgstr "%(age)s ans" msgstr "%(age)s ans"
#: com/templates/com/news_list.jinja:59 com/tests.py:92 com/tests.py:102 #: com/templates/com/news_list.jinja:58 com/tests.py:109 com/tests.py:119
msgid "You need an up to date subscription to access this content" msgid "You need an up to date subscription to access this content"
msgstr "Votre cotisation doit être à jour pour accéder à cette section" msgstr "Votre cotisation doit être à jour pour accéder à cette section"
#: com/templates/com/news_list.jinja:92 #: com/templates/com/news_list.jinja:90
msgid "Events today and the next few days" msgid "Events today and the next few days"
msgstr "Événements aujourd'hui et dans les prochains jours" msgstr "Événements aujourd'hui et dans les prochains jours"
#: com/templates/com/news_list.jinja:135 #: com/templates/com/news_list.jinja:133
msgid "Nothing to come..." msgid "Nothing to come..."
msgstr "Rien à venir..." msgstr "Rien à venir..."
#: com/templates/com/news_list.jinja:142 #: com/templates/com/news_list.jinja:140
msgid "Coming soon... don't miss!" msgid "Coming soon... don't miss!"
msgstr "Prochainement... à ne pas rater!" msgstr "Prochainement... à ne pas rater!"
@ -1797,7 +1793,7 @@ msgid "Screen - edit"
msgstr "Écran - modifier" msgstr "Écran - modifier"
#: com/templates/com/screen_list.jinja:4 com/templates/com/screen_list.jinja:11 #: com/templates/com/screen_list.jinja:4 com/templates/com/screen_list.jinja:11
#: core/templates/core/user_tools.jinja:92 #: core/templates/core/user_tools.jinja:91
msgid "Screens" msgid "Screens"
msgstr "Écrans" msgstr "Écrans"
@ -1901,7 +1897,7 @@ msgstr "Astuce"
msgid "Final word" msgid "Final word"
msgstr "Le mot de la fin" msgstr "Le mot de la fin"
#: com/views.py:78 com/views.py:215 election/views.py:185 #: com/views.py:78 com/views.py:204 election/views.py:185
#: subscription/views.py:46 #: subscription/views.py:46
msgid "Start date" msgid "Start date"
msgstr "Date de début" msgstr "Date de début"
@ -1915,46 +1911,42 @@ msgid "Weekmail destinations"
msgstr "Destinataires du Weekmail" msgstr "Destinataires du Weekmail"
#: com/views.py:118 #: com/views.py:118
msgid "Index page"
msgstr "Page d'accueil"
#: com/views.py:121
msgid "Info message" msgid "Info message"
msgstr "Message d'info" msgstr "Message d'info"
#: com/views.py:127 #: com/views.py:124
msgid "Alert message" msgid "Alert message"
msgstr "Message d'alerte" msgstr "Message d'alerte"
#: com/views.py:148 #: com/views.py:145
msgid "Screens list" msgid "Screens list"
msgstr "Liste d'écrans" msgstr "Liste d'écrans"
#: com/views.py:226 #: com/views.py:215
msgid "Until" msgid "Until"
msgstr "Jusqu'à" msgstr "Jusqu'à"
#: com/views.py:228 #: com/views.py:217
msgid "Automoderation" msgid "Automoderation"
msgstr "Automodération" msgstr "Automodération"
#: com/views.py:235 com/views.py:239 com/views.py:249 #: com/views.py:224 com/views.py:228 com/views.py:238
msgid "This field is required." msgid "This field is required."
msgstr "Ce champ est obligatoire." msgstr "Ce champ est obligatoire."
#: com/views.py:245 #: com/views.py:234
msgid "You crazy? You can not finish an event before starting it." msgid "You crazy? You can not finish an event before starting it."
msgstr "T'es fou? Un événement ne peut pas finir avant même de commencer." msgstr "T'es fou? Un événement ne peut pas finir avant même de commencer."
#: com/views.py:474 #: com/views.py:463
msgid "Delete and save to regenerate" msgid "Delete and save to regenerate"
msgstr "Supprimer et sauver pour regénérer" msgstr "Supprimer et sauver pour regénérer"
#: com/views.py:489 #: com/views.py:478
msgid "Weekmail of the " msgid "Weekmail of the "
msgstr "Weekmail du " msgstr "Weekmail du "
#: com/views.py:599 #: com/views.py:588
msgid "" msgid ""
"You must be a board member of the selected club to post in the Weekmail." "You must be a board member of the selected club to post in the Weekmail."
msgstr "" msgstr ""
@ -2148,7 +2140,7 @@ msgstr "département"
msgid "dpt option" msgid "dpt option"
msgstr "Filière" msgstr "Filière"
#: core/models.py:248 pedagogy/models.py:73 pedagogy/models.py:284 #: core/models.py:248 pedagogy/models.py:73 pedagogy/models.py:295
msgid "semester" msgid "semester"
msgstr "semestre" msgstr "semestre"
@ -2376,6 +2368,10 @@ msgstr "404. Non trouvé"
msgid "500, Server Error" msgid "500, Server Error"
msgstr "500, Erreur Serveur" msgstr "500, Erreur Serveur"
#: core/templates/core/base.jinja:5
msgid "Welcome!"
msgstr "Bienvenue !"
#: core/templates/core/base.jinja:49 #: core/templates/core/base.jinja:49
msgid "Username" msgid "Username"
msgstr "Nom d'utilisateur" msgstr "Nom d'utilisateur"
@ -2399,7 +2395,7 @@ msgstr "S'enregister"
#: matmat/templates/matmat/search_form.jinja:37 #: matmat/templates/matmat/search_form.jinja:37
#: matmat/templates/matmat/search_form.jinja:47 #: matmat/templates/matmat/search_form.jinja:47
#: matmat/templates/matmat/search_form.jinja:58 #: matmat/templates/matmat/search_form.jinja:58
#: pedagogy/templates/pedagogy/guide.jinja:21 #: pedagogy/templates/pedagogy/guide.jinja:29
msgid "Search" msgid "Search"
msgstr "Recherche" msgstr "Recherche"
@ -2503,7 +2499,7 @@ msgstr "Laverie"
msgid "Files" msgid "Files"
msgstr "Fichiers" msgstr "Fichiers"
#: core/templates/core/base.jinja:188 core/templates/core/user_tools.jinja:109 #: core/templates/core/base.jinja:188 core/templates/core/user_tools.jinja:108
msgid "Pedagogy" msgid "Pedagogy"
msgstr "Pédagogie" msgstr "Pédagogie"
@ -3445,61 +3441,57 @@ msgid "Moderate news"
msgstr "Modérer les nouvelles" msgstr "Modérer les nouvelles"
#: core/templates/core/user_tools.jinja:86 #: core/templates/core/user_tools.jinja:86
msgid "Edit index page"
msgstr "Éditer la page d'accueil"
#: core/templates/core/user_tools.jinja:87
msgid "Edit alert message" msgid "Edit alert message"
msgstr "Éditer le message d'alerte" msgstr "Éditer le message d'alerte"
#: core/templates/core/user_tools.jinja:88 #: core/templates/core/user_tools.jinja:87
msgid "Edit information message" msgid "Edit information message"
msgstr "Éditer le message d'informations" msgstr "Éditer le message d'informations"
#: core/templates/core/user_tools.jinja:89 #: core/templates/core/user_tools.jinja:88
msgid "Moderate files" msgid "Moderate files"
msgstr "Modérer les fichiers" msgstr "Modérer les fichiers"
#: core/templates/core/user_tools.jinja:95 #: core/templates/core/user_tools.jinja:94
msgid "Moderate pictures" msgid "Moderate pictures"
msgstr "Modérer les photos" msgstr "Modérer les photos"
#: core/templates/core/user_tools.jinja:112 #: core/templates/core/user_tools.jinja:111
#: pedagogy/templates/pedagogy/guide.jinja:13 #: pedagogy/templates/pedagogy/guide.jinja:20
msgid "Create UV" msgid "Create UV"
msgstr "Créer UV" msgstr "Créer UV"
#: core/templates/core/user_tools.jinja:113 #: core/templates/core/user_tools.jinja:112
#: pedagogy/templates/pedagogy/guide.jinja:16 #: pedagogy/templates/pedagogy/guide.jinja:23
#: trombi/templates/trombi/detail.jinja:10 #: trombi/templates/trombi/detail.jinja:10
msgid "Moderate comments" msgid "Moderate comments"
msgstr "Modérer les commentaires" msgstr "Modérer les commentaires"
#: core/templates/core/user_tools.jinja:118 #: core/templates/core/user_tools.jinja:117
msgid "Elections" msgid "Elections"
msgstr "Élections" msgstr "Élections"
#: core/templates/core/user_tools.jinja:120 #: core/templates/core/user_tools.jinja:119
msgid "See available elections" msgid "See available elections"
msgstr "Voir les élections disponibles" msgstr "Voir les élections disponibles"
#: core/templates/core/user_tools.jinja:121 #: core/templates/core/user_tools.jinja:120
msgid "See archived elections" msgid "See archived elections"
msgstr "Voir les élections archivées" msgstr "Voir les élections archivées"
#: core/templates/core/user_tools.jinja:123 #: core/templates/core/user_tools.jinja:122
msgid "Create a new election" msgid "Create a new election"
msgstr "Créer une nouvelle élection" msgstr "Créer une nouvelle élection"
#: core/templates/core/user_tools.jinja:128 #: core/templates/core/user_tools.jinja:127
msgid "Other tools" msgid "Other tools"
msgstr "Autres outils" msgstr "Autres outils"
#: core/templates/core/user_tools.jinja:130 #: core/templates/core/user_tools.jinja:129
msgid "Convert dokuwiki/BBcode syntax to Markdown" msgid "Convert dokuwiki/BBcode syntax to Markdown"
msgstr "Convertir de la syntaxe dokuwiki/BBcode vers Markdown" msgstr "Convertir de la syntaxe dokuwiki/BBcode vers Markdown"
#: core/templates/core/user_tools.jinja:131 #: core/templates/core/user_tools.jinja:130
msgid "Trombi tools" msgid "Trombi tools"
msgstr "Outils Trombi" msgstr "Outils Trombi"
@ -4803,11 +4795,15 @@ msgstr "Nom de famille, prénom ou surnom"
msgid "Do not vote" msgid "Do not vote"
msgstr "Ne pas voter" msgstr "Ne pas voter"
#: pedagogy/forms.py:156 #: pedagogy/forms.py:136
msgid "This user has already commented on this UV"
msgstr "Cet utilisateur a déjà commenté cette UV"
#: pedagogy/forms.py:172
msgid "Accepted reports" msgid "Accepted reports"
msgstr "Signalements acceptés" msgstr "Signalements acceptés"
#: pedagogy/forms.py:163 #: pedagogy/forms.py:179
msgid "Denied reports" msgid "Denied reports"
msgstr "Signalements refusés" msgstr "Signalements refusés"
@ -4875,47 +4871,47 @@ msgstr "heures THE"
msgid "hours TE" msgid "hours TE"
msgstr "heures TE" msgstr "heures TE"
#: pedagogy/models.py:203 pedagogy/models.py:275 #: pedagogy/models.py:214 pedagogy/models.py:286
msgid "uv" msgid "uv"
msgstr "uv" msgstr "uv"
#: pedagogy/models.py:206 #: pedagogy/models.py:217
msgid "global grade" msgid "global grade"
msgstr "note globale" msgstr "note globale"
#: pedagogy/models.py:213 #: pedagogy/models.py:224
msgid "utility grade" msgid "utility grade"
msgstr "note d'utilité" msgstr "note d'utilité"
#: pedagogy/models.py:220 #: pedagogy/models.py:231
msgid "interest grade" msgid "interest grade"
msgstr "note d'intérêt" msgstr "note d'intérêt"
#: pedagogy/models.py:227 #: pedagogy/models.py:238
msgid "teaching grade" msgid "teaching grade"
msgstr "note d'enseignement" msgstr "note d'enseignement"
#: pedagogy/models.py:234 #: pedagogy/models.py:245
msgid "work load grade" msgid "work load grade"
msgstr "note de charge de travail" msgstr "note de charge de travail"
#: pedagogy/models.py:240 #: pedagogy/models.py:251
msgid "publish date" msgid "publish date"
msgstr "date de publication" msgstr "date de publication"
#: pedagogy/models.py:278 #: pedagogy/models.py:289
msgid "grade" msgid "grade"
msgstr "note" msgstr "note"
#: pedagogy/models.py:298 #: pedagogy/models.py:309
msgid "report" msgid "report"
msgstr "signaler" msgstr "signaler"
#: pedagogy/models.py:302 #: pedagogy/models.py:313
msgid "reporter" msgid "reporter"
msgstr "signalant" msgstr "signalant"
#: pedagogy/models.py:304 #: pedagogy/models.py:315
msgid "reason" msgid "reason"
msgstr "raison" msgstr "raison"
@ -4923,36 +4919,36 @@ msgstr "raison"
msgid "UV Guide" msgid "UV Guide"
msgstr "Guide des UVs" msgstr "Guide des UVs"
#: pedagogy/templates/pedagogy/guide.jinja:25 #: pedagogy/templates/pedagogy/guide.jinja:34
#, fuzzy, python-format #, fuzzy, python-format
#| msgid "display time" #| msgid "display time"
msgid "%(display_name)s" msgid "%(display_name)s"
msgstr "temps d'affichage" msgstr "temps d'affichage"
#: pedagogy/templates/pedagogy/guide.jinja:30 #: pedagogy/templates/pedagogy/guide.jinja:41
#, fuzzy, python-format #, fuzzy, python-format
#| msgid "credit type" #| msgid "credit type"
msgid "%(credit_type)s" msgid "%(credit_type)s"
msgstr "type de crédit" msgstr "type de crédit"
#: pedagogy/templates/pedagogy/guide.jinja:43 #: pedagogy/templates/pedagogy/guide.jinja:59
#: pedagogy/templates/pedagogy/moderation.jinja:12 #: pedagogy/templates/pedagogy/moderation.jinja:12
msgid "UV" msgid "UV"
msgstr "UV" msgstr "UV"
#: pedagogy/templates/pedagogy/guide.jinja:45 #: pedagogy/templates/pedagogy/guide.jinja:61
msgid "Department" msgid "Department"
msgstr "Département" msgstr "Département"
#: pedagogy/templates/pedagogy/guide.jinja:46 #: pedagogy/templates/pedagogy/guide.jinja:62
msgid "Credit type" msgid "Credit type"
msgstr "Type de crédit" msgstr "Type de crédit"
#: pedagogy/templates/pedagogy/guide.jinja:213 #: pedagogy/templates/pedagogy/guide.jinja:229
msgid "Error connecting to the server" msgid "Error connecting to the server"
msgstr "Erreur lors de la connection au serveur" msgstr "Erreur lors de la connection au serveur"
#: pedagogy/templates/pedagogy/macros.jinja:12 #: pedagogy/templates/pedagogy/macros.jinja:13
msgid " not rated " msgid " not rated "
msgstr "non noté" msgstr "non noté"
@ -4997,27 +4993,27 @@ msgid "THE: "
msgstr "THE : " msgstr "THE : "
#: pedagogy/templates/pedagogy/uv_detail.jinja:57 #: pedagogy/templates/pedagogy/uv_detail.jinja:57
#: pedagogy/templates/pedagogy/uv_detail.jinja:146 #: pedagogy/templates/pedagogy/uv_detail.jinja:152
msgid "Global grade" msgid "Global grade"
msgstr "Note globale" msgstr "Note globale"
#: pedagogy/templates/pedagogy/uv_detail.jinja:58 #: pedagogy/templates/pedagogy/uv_detail.jinja:58
#: pedagogy/templates/pedagogy/uv_detail.jinja:147 #: pedagogy/templates/pedagogy/uv_detail.jinja:153
msgid "Utility" msgid "Utility"
msgstr "Utilité" msgstr "Utilité"
#: pedagogy/templates/pedagogy/uv_detail.jinja:59 #: pedagogy/templates/pedagogy/uv_detail.jinja:59
#: pedagogy/templates/pedagogy/uv_detail.jinja:148 #: pedagogy/templates/pedagogy/uv_detail.jinja:154
msgid "Interest" msgid "Interest"
msgstr "Intérêt" msgstr "Intérêt"
#: pedagogy/templates/pedagogy/uv_detail.jinja:60 #: pedagogy/templates/pedagogy/uv_detail.jinja:60
#: pedagogy/templates/pedagogy/uv_detail.jinja:149 #: pedagogy/templates/pedagogy/uv_detail.jinja:155
msgid "Teaching" msgid "Teaching"
msgstr "Enseignement" msgstr "Enseignement"
#: pedagogy/templates/pedagogy/uv_detail.jinja:61 #: pedagogy/templates/pedagogy/uv_detail.jinja:61
#: pedagogy/templates/pedagogy/uv_detail.jinja:150 #: pedagogy/templates/pedagogy/uv_detail.jinja:156
msgid "Work load" msgid "Work load"
msgstr "Charge de travail" msgstr "Charge de travail"
@ -5041,21 +5037,29 @@ msgstr "Concepts clefs"
msgid "UV manager: " msgid "UV manager: "
msgstr "Gestionnaire d'UV : " msgstr "Gestionnaire d'UV : "
#: pedagogy/templates/pedagogy/uv_detail.jinja:85 #: pedagogy/templates/pedagogy/uv_detail.jinja:86 pedagogy/tests.py:453
msgid ""
"You already posted a comment on this UV. If you want to comment again, "
"please modify or delete your previous comment."
msgstr ""
"Vous avez déjà commenté cette UV. Si vous voulez de nouveau commenter, "
"veuillez modifier ou supprimer votre commentaire précédent."
#: pedagogy/templates/pedagogy/uv_detail.jinja:90
msgid "Leave comment" msgid "Leave comment"
msgstr "Laisser un commentaire" msgstr "Laisser un commentaire"
#: pedagogy/templates/pedagogy/uv_detail.jinja:140 #: pedagogy/templates/pedagogy/uv_detail.jinja:146
#: stock/templates/stock/shopping_list_items.jinja:42 stock/views.py:278 #: stock/templates/stock/shopping_list_items.jinja:42 stock/views.py:278
#: trombi/templates/trombi/export.jinja:70 #: trombi/templates/trombi/export.jinja:70
msgid "Comments" msgid "Comments"
msgstr "Commentaires" msgstr "Commentaires"
#: pedagogy/templates/pedagogy/uv_detail.jinja:172 #: pedagogy/templates/pedagogy/uv_detail.jinja:178
msgid "This comment has been reported" msgid "This comment has been reported"
msgstr "Ce commentaire a été signalé" msgstr "Ce commentaire a été signalé"
#: pedagogy/templates/pedagogy/uv_detail.jinja:185 #: pedagogy/templates/pedagogy/uv_detail.jinja:191
msgid "Report this comment" msgid "Report this comment"
msgstr "Signaler ce commentaire" msgstr "Signaler ce commentaire"

View File

@ -1,7 +1,7 @@
# -*- coding:utf-8 -* # -*- coding:utf-8 -*
# #
# Copyright 2016,2017 # Copyright 2019
# - Skia <skia@libskia.so> # - Sli <antoine@bartuccio.fr>
# #
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, # Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
# http://ae.utbm.fr. # http://ae.utbm.fr.
@ -116,12 +116,28 @@ class UVCommentForm(forms.ModelForm):
"grade_work_load": StarList(5), "grade_work_load": StarList(5),
} }
def __init__(self, author_id, uv_id, *args, **kwargs): def __init__(self, author_id, uv_id, is_creation, *args, **kwargs):
super(UVCommentForm, self).__init__(*args, **kwargs) super(UVCommentForm, self).__init__(*args, **kwargs)
self.fields["author"].queryset = User.objects.filter(id=author_id).all() self.fields["author"].queryset = User.objects.filter(id=author_id).all()
self.fields["author"].initial = author_id self.fields["author"].initial = author_id
self.fields["uv"].queryset = UV.objects.filter(id=uv_id).all() self.fields["uv"].queryset = UV.objects.filter(id=uv_id).all()
self.fields["uv"].initial = uv_id self.fields["uv"].initial = uv_id
self.is_creation = is_creation
def clean(self):
self.cleaned_data = super(UVCommentForm, self).clean()
uv = self.cleaned_data.get("uv")
author = self.cleaned_data.get("author")
if self.is_creation and uv and author and uv.has_user_already_commented(author):
self.add_error(
None,
forms.ValidationError(
_("This user has already commented on this UV"), code="invalid"
),
)
return self.cleaned_data
class UVCommentReportForm(forms.ModelForm): class UVCommentReportForm(forms.ModelForm):

View File

@ -164,6 +164,17 @@ class UV(models.Model):
def get_absolute_url(self): def get_absolute_url(self):
return reverse("pedagogy:uv_detail", kwargs={"uv_id": self.id}) return reverse("pedagogy:uv_detail", kwargs={"uv_id": self.id})
def has_user_already_commented(self, user):
"""
Help prevent multiples comments from the same user
This function checks that no other comment has been posted by a specified user
:param user: core.models.User
:return: if the user has already posted a comment on this UV
:rtype: bool
"""
return self.comments.filter(author=user).exists()
@cached_property @cached_property
def grade_global_average(self): def grade_global_average(self):
return self.__grade_average_generic("grade_global") return self.__grade_average_generic("grade_global")

View File

@ -81,6 +81,11 @@
</div> </div>
<br> <br>
{% if object.has_user_already_commented(user) %}
<div id="leave_comment_not_allowed">
<p>{% trans %}You already posted a comment on this UV. If you want to comment again, please modify or delete your previous comment.{% endtrans %}</p>
</div>
{% else %}
<div id="leave_comment"> <div id="leave_comment">
<h2>{% trans %}Leave comment{% endtrans %}</h2> <h2>{% trans %}Leave comment{% endtrans %}</h2>
<div> <div>
@ -134,6 +139,7 @@
</form> </form>
</div> </div>
</div> </div>
{% endif %}
<br> <br>
{% if object.comments.exists() %} {% if object.comments.exists() %}

View File

@ -25,6 +25,7 @@
from django.conf import settings from django.conf import settings
from django.test import TestCase from django.test import TestCase
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from django.core.management import call_command from django.core.management import call_command
from core.models import User, Notification from core.models import User, Notification
@ -421,6 +422,50 @@ class UVCommentCreationAndDisplay(TestCase):
) )
self.assertNotContains(response, text="Superbe UV") self.assertNotContains(response, text="Superbe UV")
def test_create_uv_comment_twice_fail(self):
# Checks that the has_user_already_commented method works proprely
self.assertFalse(self.uv.has_user_already_commented(self.bibou))
# Create a first comment
self.client.login(username="root", password="plop")
self.client.post(
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
create_uv_comment_template(self.bibou.id),
)
# Checks that the has_user_already_commented method works proprely
self.assertTrue(self.uv.has_user_already_commented(self.bibou))
# Create the second comment
comment = create_uv_comment_template(self.bibou.id)
comment["comment"] = "Twice"
response = self.client.post(
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}), comment
)
self.assertEquals(response.status_code, 200)
self.assertTrue(
UVComment.objects.filter(comment__contains="Superbe UV").exists()
)
self.assertFalse(UVComment.objects.filter(comment__contains="Twice").exists())
self.assertContains(
response,
_(
"You already posted a comment on this UV. If you want to comment again, please modify or delete your previous comment."
),
)
# Ensure that there is no crash when no uv or no author is given
self.client.post(
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
create_uv_comment_template(self.bibou.id, exclude_list=["uv"]),
)
self.assertEquals(response.status_code, 200)
self.client.post(
reverse("pedagogy:uv_detail", kwargs={"uv_id": self.uv.id}),
create_uv_comment_template(self.bibou.id, exclude_list=["author"]),
)
self.assertEquals(response.status_code, 200)
class UVCommentDeleteTest(TestCase): class UVCommentDeleteTest(TestCase):
""" """

View File

@ -1,6 +1,6 @@
# -*- coding:utf-8 -* # -*- coding:utf-8 -*
# #
# Copyright 2017 # Copyright 2019
# - Sli <antoine@bartuccio.fr> # - Sli <antoine@bartuccio.fr>
# #
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM, # Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
@ -99,6 +99,7 @@ class UVDetailFormView(CanViewMixin, CanCreateUVFunctionMixin, DetailFormView):
kwargs = super(UVDetailFormView, self).get_form_kwargs() kwargs = super(UVDetailFormView, self).get_form_kwargs()
kwargs["author_id"] = self.request.user.id kwargs["author_id"] = self.request.user.id
kwargs["uv_id"] = self.get_object().id kwargs["uv_id"] = self.get_object().id
kwargs["is_creation"] = True
return kwargs return kwargs
def form_valid(self, form): def form_valid(self, form):
@ -126,6 +127,7 @@ class UVCommentUpdateView(CanEditPropMixin, UpdateView):
obj = self.get_object() obj = self.get_object()
kwargs["author_id"] = obj.author.id kwargs["author_id"] = obj.author.id
kwargs["uv_id"] = obj.uv.id kwargs["uv_id"] = obj.uv.id
kwargs["is_creation"] = False
return kwargs return kwargs