Allow to unmoderate news

This commit is contained in:
Skia 2017-05-13 18:31:23 +02:00
parent 231cb236dc
commit 0a84ef8438
4 changed files with 64 additions and 55 deletions

View File

@ -36,7 +36,8 @@
<td>{{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }} <td>{{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }}
{{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</td> {{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</td>
<td><a href="{{ url('com:news_detail', news_id=news.id) }}">{% trans %}View{% endtrans %}</a> <td><a href="{{ url('com:news_detail', news_id=news.id) }}">{% trans %}View{% endtrans %}</a>
<a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit{% endtrans %}</a> </td> <a href="{{ url('com:news_edit', news_id=news.id) }}">{% trans %}Edit{% endtrans %}</a>
<a href="{{ url('com:news_moderate', news_id=news.id) }}?remove">{% trans %}Remove{% endtrans %}</a></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>

View File

@ -26,6 +26,9 @@ section.news_event:nth-of-type(even) {
{% block content %} {% block content %}
<h3>{% trans %}News{% endtrans %}</h3> <h3>{% trans %}News{% endtrans %}</h3>
{% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) %}
<a href="{{ url('com:news_admin_list') }}">{% trans %}Administrate news{% endtrans %}</a>
{% endif %}
{% for news in object_list.filter(type="NOTICE") %} {% for news in object_list.filter(type="NOTICE") %}
<section class="news_notice"> <section class="news_notice">
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4> <h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>

View File

@ -192,7 +192,7 @@ class NewsEditView(CanEditMixin, UpdateView):
Notification(user=u, url=reverse("com:news_detail", kwargs={'news_id': self.object.id}), type="NEWS_MODERATION").save() Notification(user=u, url=reverse("com:news_detail", kwargs={'news_id': self.object.id}), type="NEWS_MODERATION").save()
return super(NewsEditView, self).form_valid(form) return super(NewsEditView, self).form_valid(form)
class NewsCreateView(CanCreateMixin, CreateView): #XXX no can_be_created_by function in News model class NewsCreateView(CanCreateMixin, CreateView):
model = News model = News
form_class = NewsForm form_class = NewsForm
template_name = 'com/news_edit.jinja' template_name = 'com/news_edit.jinja'
@ -230,7 +230,10 @@ class NewsModerateView(CanEditMixin, SingleObjectMixin):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.object = self.get_object() self.object = self.get_object()
self.object.is_moderated = True if 'remove' in request.GET.keys():
self.object.is_moderated = False
else:
self.object.is_moderated = True
self.object.moderator = request.user self.object.moderator = request.user
self.object.save() self.object.save()
if 'next' in self.request.GET.keys(): if 'next' in self.request.GET.keys():

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-12 16:56+0200\n" "POT-Creation-Date: 2017-05-13 18:31+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"
@ -185,7 +185,7 @@ msgstr "Utilisateur"
#: accounting/models.py:267 club/templates/club/club_detail.jinja:5 #: accounting/models.py:267 club/templates/club/club_detail.jinja:5
#: com/templates/com/news_admin_list.jinja:17 #: com/templates/com/news_admin_list.jinja:17
#: com/templates/com/news_admin_list.jinja:51 #: com/templates/com/news_admin_list.jinja:52
#: com/templates/com/weekmail.jinja:18 com/templates/com/weekmail.jinja:47 #: com/templates/com/weekmail.jinja:18 com/templates/com/weekmail.jinja:47
#: counter/templates/counter/invoices_call.jinja:23 #: counter/templates/counter/invoices_call.jinja:23
msgid "Club" msgid "Club"
@ -335,12 +335,11 @@ msgstr "Compte en banque : "
#: counter/templates/counter/last_ops.jinja:59 #: counter/templates/counter/last_ops.jinja:59
#: election/templates/election/election_detail.jinja:280 #: election/templates/election/election_detail.jinja:280
#: election/templates/election/election_detail.jinja:329 #: election/templates/election/election_detail.jinja:329
#: forum/templates/forum/macros.jinja:20 #: forum/templates/forum/macros.jinja:20 forum/templates/forum/macros.jinja:110
#: forum/templates/forum/macros.jinja:110
#: launderette/templates/launderette/launderette_admin.jinja:16 #: launderette/templates/launderette/launderette_admin.jinja:16
#: launderette/views.py:178 sas/templates/sas/album.jinja:26 #: launderette/views.py:178 sas/templates/sas/album.jinja:26
#: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:74 #: sas/templates/sas/moderation.jinja:18 sas/templates/sas/picture.jinja:74
#: sas/templates/sas/picture.jinja:124 #: sas/templates/sas/picture.jinja.py:124
#: stock/templates/stock/stock_shopping_list.jinja:43 #: stock/templates/stock/stock_shopping_list.jinja:43
#: stock/templates/stock/stock_shopping_list.jinja:69 #: stock/templates/stock/stock_shopping_list.jinja:69
#: trombi/templates/trombi/detail.jinja:28 #: trombi/templates/trombi/detail.jinja:28
@ -369,7 +368,7 @@ msgstr "Nouveau compte club"
#: accounting/templates/accounting/club_account_details.jinja:57 #: accounting/templates/accounting/club_account_details.jinja:57
#: accounting/templates/accounting/journal_details.jinja:83 club/views.py:79 #: accounting/templates/accounting/journal_details.jinja:83 club/views.py:79
#: com/templates/com/news_admin_list.jinja:39 #: com/templates/com/news_admin_list.jinja:39
#: com/templates/com/news_admin_list.jinja:71 #: com/templates/com/news_admin_list.jinja:72
#: com/templates/com/weekmail.jinja:32 com/templates/com/weekmail.jinja:61 #: com/templates/com/weekmail.jinja:32 com/templates/com/weekmail.jinja:61
#: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31 #: core/templates/core/file.jinja:38 core/templates/core/page.jinja:31
#: core/templates/core/user_tools.jinja:39 core/views/user.py:177 #: core/templates/core/user_tools.jinja:39 core/views/user.py:177
@ -445,13 +444,13 @@ msgstr "Nom"
#: accounting/templates/accounting/club_account_details.jinja:31 #: accounting/templates/accounting/club_account_details.jinja:31
#: com/templates/com/news_admin_list.jinja:20 #: com/templates/com/news_admin_list.jinja:20
#: com/templates/com/news_admin_list.jinja:53 #: com/templates/com/news_admin_list.jinja:54
msgid "Start" msgid "Start"
msgstr "Début" msgstr "Début"
#: accounting/templates/accounting/club_account_details.jinja:32 #: accounting/templates/accounting/club_account_details.jinja:32
#: com/templates/com/news_admin_list.jinja:21 #: com/templates/com/news_admin_list.jinja:21
#: com/templates/com/news_admin_list.jinja:54 #: com/templates/com/news_admin_list.jinja:55
msgid "End" msgid "End"
msgstr "Fin" msgstr "Fin"
@ -474,7 +473,7 @@ msgstr "Fermé"
#: accounting/templates/accounting/club_account_details.jinja:36 #: accounting/templates/accounting/club_account_details.jinja:36
#: accounting/templates/accounting/journal_details.jinja:41 #: accounting/templates/accounting/journal_details.jinja:41
#: com/templates/com/news_admin_list.jinja:22 #: com/templates/com/news_admin_list.jinja:22
#: com/templates/com/news_admin_list.jinja:55 #: com/templates/com/news_admin_list.jinja:56
#: com/templates/com/weekmail.jinja:21 com/templates/com/weekmail.jinja:50 #: com/templates/com/weekmail.jinja:21 com/templates/com/weekmail.jinja:50
msgid "Actions" msgid "Actions"
msgstr "Actions" msgstr "Actions"
@ -491,8 +490,8 @@ msgstr "Non"
#: accounting/templates/accounting/club_account_details.jinja:56 #: accounting/templates/accounting/club_account_details.jinja:56
#: com/templates/com/news_admin_list.jinja:38 #: com/templates/com/news_admin_list.jinja:38
#: com/templates/com/news_admin_list.jinja:70 #: com/templates/com/news_admin_list.jinja:71 core/templates/core/file.jinja:36
#: core/templates/core/file.jinja:36 core/templates/core/page.jinja:28 #: core/templates/core/page.jinja:28
msgid "View" msgid "View"
msgstr "Voir" msgstr "Voir"
@ -859,8 +858,7 @@ msgstr "L'utilisateur est déjà membre de ce club"
msgid "past member" msgid "past member"
msgstr "Anciens membres" msgstr "Anciens membres"
#: club/templates/club/club_list.jinja:4 #: club/templates/club/club_list.jinja:4 club/templates/club/club_list.jinja:24
#: club/templates/club/club_list.jinja:24
msgid "Club list" msgid "Club list"
msgstr "Liste des clubs" msgstr "Liste des clubs"
@ -922,14 +920,13 @@ msgstr "Du"
msgid "To" msgid "To"
msgstr "Au" msgstr "Au"
#: club/templates/club/club_sellings.jinja:5 club/views.py:84 #: club/templates/club/club_sellings.jinja:5 club/views.py:84 club/views.py:247
#: club/views.py:247 counter/templates/counter/counter_main.jinja:19 #: counter/templates/counter/counter_main.jinja:19
#: counter/templates/counter/last_ops.jinja:35 #: counter/templates/counter/last_ops.jinja:35
msgid "Sellings" msgid "Sellings"
msgstr "Ventes" msgstr "Ventes"
#: club/templates/club/club_sellings.jinja:9 #: club/templates/club/club_sellings.jinja:9 club/templates/club/stats.jinja:19
#: club/templates/club/stats.jinja:19
#: counter/templates/counter/cash_summary_list.jinja:15 #: counter/templates/counter/cash_summary_list.jinja:15
msgid "Show" msgid "Show"
msgstr "Montrer" msgstr "Montrer"
@ -1102,7 +1099,7 @@ msgstr "Information"
msgid "Event" msgid "Event"
msgstr "Événement" msgstr "Événement"
#: com/models.py:54 com/templates/com/news_list.jinja:81 #: com/models.py:54 com/templates/com/news_list.jinja:84
msgid "Weekly" msgid "Weekly"
msgstr "Hebdomadaire" msgstr "Hebdomadaire"
@ -1186,9 +1183,8 @@ msgid "News admin"
msgstr "Administration des nouvelles" msgstr "Administration des nouvelles"
#: com/templates/com/news_admin_list.jinja:9 #: com/templates/com/news_admin_list.jinja:9
#: com/templates/com/news_detail.jinja:5 #: com/templates/com/news_detail.jinja:5 com/templates/com/news_detail.jinja:11
#: com/templates/com/news_detail.jinja:11 com/templates/com/news_list.jinja:4 #: com/templates/com/news_list.jinja:4 com/templates/com/news_list.jinja:28
#: com/templates/com/news_list.jinja:28
msgid "News" msgid "News"
msgstr "Nouvelles" msgstr "Nouvelles"
@ -1197,14 +1193,14 @@ msgid "Displayed news"
msgstr "Nouvelles affichées" msgstr "Nouvelles affichées"
#: com/templates/com/news_admin_list.jinja:14 #: com/templates/com/news_admin_list.jinja:14
#: com/templates/com/news_admin_list.jinja:48 #: com/templates/com/news_admin_list.jinja:49
#: launderette/templates/launderette/launderette_admin.jinja:42 #: launderette/templates/launderette/launderette_admin.jinja:42
#: launderette/views.py:180 #: launderette/views.py:180
msgid "Type" msgid "Type"
msgstr "Type" msgstr "Type"
#: com/templates/com/news_admin_list.jinja:15 #: com/templates/com/news_admin_list.jinja:15
#: com/templates/com/news_admin_list.jinja:49 #: com/templates/com/news_admin_list.jinja:50
#: 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:26 forum/templates/forum/forum.jinja:44 #: forum/templates/forum/forum.jinja:26 forum/templates/forum/forum.jinja:44
#: forum/views.py:127 #: forum/views.py:127
@ -1212,12 +1208,12 @@ msgid "Title"
msgstr "Titre" msgstr "Titre"
#: com/templates/com/news_admin_list.jinja:16 #: com/templates/com/news_admin_list.jinja:16
#: com/templates/com/news_admin_list.jinja:50 #: com/templates/com/news_admin_list.jinja:51
msgid "Summary" msgid "Summary"
msgstr "Résumé" msgstr "Résumé"
#: com/templates/com/news_admin_list.jinja:18 #: com/templates/com/news_admin_list.jinja:18
#: com/templates/com/news_admin_list.jinja:52 #: com/templates/com/news_admin_list.jinja:53
#: com/templates/com/weekmail.jinja:17 com/templates/com/weekmail.jinja:46 #: com/templates/com/weekmail.jinja:17 com/templates/com/weekmail.jinja:46
#: forum/templates/forum/forum.jinja:48 #: forum/templates/forum/forum.jinja:48
msgid "Author" msgid "Author"
@ -1227,11 +1223,15 @@ msgstr "Auteur"
msgid "Moderator" msgid "Moderator"
msgstr "Modérateur" msgstr "Modérateur"
#: com/templates/com/news_admin_list.jinja:44 #: com/templates/com/news_admin_list.jinja:40
msgid "Remove"
msgstr ""
#: com/templates/com/news_admin_list.jinja:45
msgid "News to moderate" msgid "News to moderate"
msgstr "Nouvelles à modérer" msgstr "Nouvelles à modérer"
#: com/templates/com/news_admin_list.jinja:72 #: com/templates/com/news_admin_list.jinja:73
#: com/templates/com/news_detail.jinja:26 #: com/templates/com/news_detail.jinja:26
#: core/templates/core/file_detail.jinja:65 #: core/templates/core/file_detail.jinja:65
#: core/templates/core/file_moderation.jinja:23 #: core/templates/core/file_moderation.jinja:23
@ -1293,11 +1293,15 @@ msgstr ""
msgid "Preview" msgid "Preview"
msgstr "Prévisualiser" msgstr "Prévisualiser"
#: com/templates/com/news_list.jinja:48 #: com/templates/com/news_list.jinja:30
msgid "Administrate news"
msgstr "Administrer les news"
#: com/templates/com/news_list.jinja:51
msgid "Events today and the next few days" msgid "Events today and the next few days"
msgstr "Événement aujourd'hui et dans les prochains jours" msgstr "Événement aujourd'hui et dans les prochains jours"
#: com/templates/com/news_list.jinja:67 #: com/templates/com/news_list.jinja:70
msgid "Coming soon... don't miss!" msgid "Coming soon... don't miss!"
msgstr "Prochainement... à ne pas rater!" msgstr "Prochainement... à ne pas rater!"
@ -1428,11 +1432,11 @@ msgstr "Ce champ est obligatoire."
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:290 #: com/views.py:293
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:298 #: com/views.py:301
msgid "Weekmail of the " msgid "Weekmail of the "
msgstr "Weekmail du " msgstr "Weekmail du "
@ -1861,8 +1865,7 @@ msgstr "S'enregister"
msgid "View more" msgid "View more"
msgstr "Voir plus" msgstr "Voir plus"
#: core/templates/core/base.jinja:62 #: core/templates/core/base.jinja:62 forum/templates/forum/last_unread.jinja:15
#: forum/templates/forum/last_unread.jinja:15
msgid "Mark all as read" msgid "Mark all as read"
msgstr "Marquer tout commme lu" msgstr "Marquer tout commme lu"
@ -1894,7 +1897,7 @@ msgstr "SAS"
#: core/templates/core/base.jinja:94 forum/templates/forum/forum.jinja:10 #: core/templates/core/base.jinja:94 forum/templates/forum/forum.jinja:10
#: forum/templates/forum/last_unread.jinja:12 #: forum/templates/forum/last_unread.jinja:12
#: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja:11 #: forum/templates/forum/main.jinja:6 forum/templates/forum/main.jinja.py:11
#: forum/templates/forum/main.jinja:13 forum/templates/forum/reply.jinja:15 #: forum/templates/forum/main.jinja:13 forum/templates/forum/reply.jinja:15
#: forum/templates/forum/topic.jinja:30 #: forum/templates/forum/topic.jinja:30
msgid "Forum" msgid "Forum"
@ -2108,13 +2111,11 @@ msgstr "login"
msgid "Lost password?" msgid "Lost password?"
msgstr "Mot de passe perdu ?" msgstr "Mot de passe perdu ?"
#: core/templates/core/macros.jinja:27 #: core/templates/core/macros.jinja:27 core/templates/core/user_detail.jinja:27
#: core/templates/core/user_detail.jinja:27
msgid "Born: " msgid "Born: "
msgstr "Né le : " msgstr "Né le : "
#: core/templates/core/macros.jinja:31 #: core/templates/core/macros.jinja:31 core/templates/core/user_detail.jinja:48
#: core/templates/core/user_detail.jinja:48
msgid "Promo: " msgid "Promo: "
msgstr "Promo : " msgstr "Promo : "
@ -4444,6 +4445,7 @@ msgstr "Fin des commentaires : "
#: trombi/templates/trombi/user_profile.jinja:4 #: trombi/templates/trombi/user_profile.jinja:4
#: trombi/templates/trombi/user_profile.jinja:8 #: trombi/templates/trombi/user_profile.jinja:8
#, python-format
msgid "%(user_name)s's Trombi profile" msgid "%(user_name)s's Trombi profile"
msgstr "Profil Trombi de %(user_name)s" msgstr "Profil Trombi de %(user_name)s"
@ -4489,15 +4491,15 @@ msgstr ""
msgid "Edit comment" msgid "Edit comment"
msgstr "Éditer le commentaire" msgstr "Éditer le commentaire"
#: trombi/views.py:110 #: trombi/views.py:111
msgid "Explain why you rejected the comment" msgid "Explain why you rejected the comment"
msgstr "Expliquez pourquoi vous refusez le commentaire" msgstr "Expliquez pourquoi vous refusez le commentaire"
#: trombi/views.py:132 #: trombi/views.py:135
msgid "Rejected comment" msgid "Rejected comment"
msgstr "Commentaire rejeté" msgstr "Commentaire rejeté"
#: trombi/views.py:133 #: trombi/views.py:136
#, python-format #, python-format
msgid "" msgid ""
"Your comment to %(target)s on the Trombi \"%(trombi)s\" was rejected for the " "Your comment to %(target)s on the Trombi \"%(trombi)s\" was rejected for the "
@ -4507,23 +4509,23 @@ msgid ""
"\n" "\n"
"%(content)s" "%(content)s"
msgstr "" msgstr ""
"Votre commentaire pour %(target)s sur le Trombi \"%(trombi)s\" a été rejecté pour le " "Votre commentaire pour %(target)s sur le Trombi \"%(trombi)s\" a été rejecté "
"motif suivant: %(reason)s\n" "pour le motif suivant: %(reason)s\n"
"\n" "\n"
"Votre commentaire était:\n" "Votre commentaire était:\n"
"\n" "\n"
"%(content)s" "%(content)s"
#: trombi/views.py:156 #: trombi/views.py:159
#, python-format #, python-format
msgid "%(name)s (deadline: %(date)s)" msgid "%(name)s (deadline: %(date)s)"
msgstr "%(name)s (date limite: %(date)s)" msgstr "%(name)s (date limite: %(date)s)"
#: trombi/views.py:159 #: trombi/views.py:162
msgid "Select trombi" msgid "Select trombi"
msgstr "Choisir un trombi" msgstr "Choisir un trombi"
#: trombi/views.py:160 #: trombi/views.py:163
msgid "" msgid ""
"This allows you to subscribe to a Trombi. Be aware that you can subscribe " "This allows you to subscribe to a Trombi. Be aware that you can subscribe "
"only once, so don't play with that, or you will expose yourself to the " "only once, so don't play with that, or you will expose yourself to the "
@ -4533,19 +4535,19 @@ msgstr ""
"pouvez vous inscrire qu'à un seul Trombi, donc ne jouez pas avec cet option " "pouvez vous inscrire qu'à un seul Trombi, donc ne jouez pas avec cet option "
"ou vous encourerez la colère des admins!" "ou vous encourerez la colère des admins!"
#: trombi/views.py:206 #: trombi/views.py:209
msgid "Personal email (not UTBM)" msgid "Personal email (not UTBM)"
msgstr "Email personnel (pas UTBM)" msgstr "Email personnel (pas UTBM)"
#: trombi/views.py:207 #: trombi/views.py:210
msgid "Phone" msgid "Phone"
msgstr "Téléphone" msgstr "Téléphone"
#: trombi/views.py:208 #: trombi/views.py:211
msgid "Native town" msgid "Native town"
msgstr "Ville d'origine" msgstr "Ville d'origine"
#: trombi/views.py:243 #: trombi/views.py:246
msgid "" msgid ""
"You can not yet write comment, you must wait for the subscription deadline " "You can not yet write comment, you must wait for the subscription deadline "
"to be passed." "to be passed."
@ -4553,11 +4555,11 @@ msgstr ""
"Vous ne pouvez pas encore écrire de commentaires, vous devez attendre la fin " "Vous ne pouvez pas encore écrire de commentaires, vous devez attendre la fin "
"des inscriptions" "des inscriptions"
#: trombi/views.py:246 #: trombi/views.py:249
msgid "You can not write comment anymore, the deadline is already passed." msgid "You can not write comment anymore, the deadline is already passed."
msgstr "Vous ne pouvez plus écrire de commentaires, la date est passée." msgstr "Vous ne pouvez plus écrire de commentaires, la date est passée."
#: trombi/views.py:253 #: trombi/views.py:256
#, python-format #, python-format
msgid "Maximum characters: %(max_length)s" msgid "Maximum characters: %(max_length)s"
msgstr "Nombre de caractères max: %(max_length)s" msgstr "Nombre de caractères max: %(max_length)s"