mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-25 17:21:15 +00:00
Add notification with a fresh new
This commit is contained in:
parent
be44a3ab0b
commit
b79c77f268
11
com/views.py
11
com/views.py
@ -6,6 +6,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from django.core.urlresolvers import reverse, reverse_lazy
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils import timezone
|
||||
from django.conf import settings
|
||||
from django import forms
|
||||
|
||||
from datetime import timedelta
|
||||
@ -13,6 +14,7 @@ from datetime import timedelta
|
||||
from com.models import Sith, News, NewsDate
|
||||
from core.views import CanViewMixin, CanEditMixin, CanEditPropMixin, TabedViewMixin, CanCreateMixin
|
||||
from core.views.forms import SelectDateTime
|
||||
from core.models import Notification, RealGroup
|
||||
from club.models import Club
|
||||
|
||||
|
||||
@ -141,6 +143,9 @@ class NewsEditView(CanEditMixin, UpdateView):
|
||||
else:
|
||||
self.object.is_moderated = False
|
||||
self.object.save()
|
||||
for u in RealGroup.objects.filter(id=settings.SITH_GROUP_COM_ADMIN_ID).first().users.all():
|
||||
if not u.notifications.filter(type="NEWS_MODERATION", viewed=False).exists():
|
||||
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)
|
||||
|
||||
class NewsCreateView(CanCreateMixin, CreateView):
|
||||
@ -165,12 +170,14 @@ class NewsCreateView(CanCreateMixin, CreateView):
|
||||
|
||||
def form_valid(self, form):
|
||||
self.object = form.save()
|
||||
print(form.cleaned_data)
|
||||
if form.cleaned_data['automoderation'] and self.request.user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID):
|
||||
print("GUY")
|
||||
self.object.moderator = self.request.user
|
||||
self.object.is_moderated = True
|
||||
self.object.save()
|
||||
else:
|
||||
for u in RealGroup.objects.filter(id=settings.SITH_GROUP_COM_ADMIN_ID).first().users.all():
|
||||
if not u.notifications.filter(type="NEWS_MODERATION", viewed=False).exists():
|
||||
Notification(user=u, url=reverse("com:news_detail", kwargs={'news_id': self.object.id}), type="NEWS_MODERATION").save()
|
||||
return super(NewsCreateView, self).form_valid(form)
|
||||
|
||||
class NewsModerateView(CanEditMixin, SingleObjectMixin):
|
||||
|
@ -6,7 +6,7 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2016-12-23 19:35+0100\n"
|
||||
"POT-Creation-Date: 2016-12-23 20:10+0100\n"
|
||||
"PO-Revision-Date: 2016-07-18\n"
|
||||
"Last-Translator: Skia <skia@libskia.so>\n"
|
||||
"Language-Team: AE info <ae.info@utbm.fr>\n"
|
||||
@ -979,7 +979,7 @@ msgstr "Vous n'avez pas la permission de faire cela"
|
||||
msgid "Begin date"
|
||||
msgstr "Date de début"
|
||||
|
||||
#: club/views.py:166 com/views.py:79 counter/views.py:909
|
||||
#: club/views.py:166 com/views.py:81 counter/views.py:909
|
||||
msgid "End date"
|
||||
msgstr "Date de fin"
|
||||
|
||||
@ -1057,11 +1057,6 @@ msgstr "date de début"
|
||||
msgid "end_date"
|
||||
msgstr "date de fin"
|
||||
|
||||
#: com/templates/com/macros.jinja:26 com/templates/com/news_detail.jinja:22
|
||||
#: com/templates/com/news_edit.jinja:34
|
||||
msgid "Author: "
|
||||
msgstr "Auteur : "
|
||||
|
||||
#: com/templates/com/news_admin_list.jinja:5
|
||||
msgid "News admin"
|
||||
msgstr "Administration des nouvelles"
|
||||
@ -1118,6 +1113,10 @@ msgstr "Modérer"
|
||||
msgid "Back to news"
|
||||
msgstr "Retour aux nouvelles"
|
||||
|
||||
#: com/templates/com/news_detail.jinja:22 com/templates/com/news_edit.jinja:34
|
||||
msgid "Author: "
|
||||
msgstr "Auteur : "
|
||||
|
||||
#: com/templates/com/news_detail.jinja:24 sas/templates/sas/picture.jinja:82
|
||||
msgid "Moderator: "
|
||||
msgstr "Modérateur : "
|
||||
@ -1147,14 +1146,15 @@ msgid ""
|
||||
"Weekly: recurrent event, associated with many dates (specify the first one, "
|
||||
"and a deadline)"
|
||||
msgstr ""
|
||||
"Hebdomadaire : événement récurrent, associé à plusieurs dates (spécifier la première, "
|
||||
"ainsi que la date de fin)"
|
||||
"Hebdomadaire : événement récurrent, associé à plusieurs dates (spécifier la "
|
||||
"première, ainsi que la date de fin)"
|
||||
|
||||
#: com/templates/com/news_edit.jinja:51
|
||||
msgid ""
|
||||
"Call: long time event, associated with a long date (election appliance, ...)"
|
||||
msgstr ""
|
||||
"Appel : événement de longue durée, associé à une longue date (candidature, concours, ...)"
|
||||
"Appel : événement de longue durée, associé à une longue date (candidature, "
|
||||
"concours, ...)"
|
||||
|
||||
#: com/templates/com/news_edit.jinja:65
|
||||
#: core/templates/core/pagerev_edit.jinja:23
|
||||
@ -1169,35 +1169,35 @@ msgstr "Événement aujourd'hui et dans les prochains jours"
|
||||
msgid "Coming soon... don't miss!"
|
||||
msgstr "Prochainement... à ne pas rater!"
|
||||
|
||||
#: com/views.py:25
|
||||
#: com/views.py:27
|
||||
msgid "Communication administration"
|
||||
msgstr "Administration de la communication"
|
||||
|
||||
#: com/views.py:32
|
||||
#: com/views.py:34
|
||||
msgid "Index page"
|
||||
msgstr "Page d'accueil"
|
||||
|
||||
#: com/views.py:37
|
||||
#: com/views.py:39
|
||||
msgid "Info message"
|
||||
msgstr "Message d'info"
|
||||
|
||||
#: com/views.py:42
|
||||
#: com/views.py:44
|
||||
msgid "Alert message"
|
||||
msgstr "Message d'alerte"
|
||||
|
||||
#: com/views.py:78
|
||||
#: com/views.py:80
|
||||
msgid "Start date"
|
||||
msgstr "Date de début"
|
||||
|
||||
#: com/views.py:80
|
||||
#: com/views.py:82
|
||||
msgid "Until"
|
||||
msgstr "Jusqu'à"
|
||||
|
||||
#: com/views.py:81
|
||||
#: com/views.py:83
|
||||
msgid "Automoderation"
|
||||
msgstr "Automodération"
|
||||
|
||||
#: com/views.py:87 com/views.py:89 com/views.py:91
|
||||
#: com/views.py:89 com/views.py:91 com/views.py:93
|
||||
msgid "This field is required."
|
||||
msgstr "Ce champ est obligatoire."
|
||||
|
||||
@ -3407,28 +3407,32 @@ msgid "Curious"
|
||||
msgstr "Curieux"
|
||||
|
||||
#: sith/settings.py:443
|
||||
msgid "A fresh new to be moderated"
|
||||
msgstr "Une nouvelle toute neuve à modérer"
|
||||
|
||||
#: sith/settings.py:444
|
||||
msgid "New files to be moderated"
|
||||
msgstr "Nouveaux fichiers à modérer"
|
||||
|
||||
#: sith/settings.py:444
|
||||
#: sith/settings.py:445
|
||||
msgid "New pictures/album to be moderated in the SAS"
|
||||
msgstr "Nouvelles photos/albums à modérer dans le SAS"
|
||||
|
||||
#: sith/settings.py:445
|
||||
#: sith/settings.py:446
|
||||
msgid "You've been identified on some pictures"
|
||||
msgstr "Vous avez été identifié sur des photos"
|
||||
|
||||
#: sith/settings.py:446
|
||||
#: sith/settings.py:447
|
||||
#, python-format
|
||||
msgid "You just refilled of %s €"
|
||||
msgstr "Vous avez rechargé votre compte de %s €"
|
||||
|
||||
#: sith/settings.py:447
|
||||
#: sith/settings.py:448
|
||||
#, python-format
|
||||
msgid "You just bought %s"
|
||||
msgstr "Vous avez acheté %s"
|
||||
|
||||
#: sith/settings.py:448
|
||||
#: sith/settings.py:449
|
||||
msgid "You have a notification"
|
||||
msgstr "Vous avez une notification"
|
||||
|
||||
|
@ -440,6 +440,7 @@ SITH_LAUNDERETTE_PRICES = {
|
||||
}
|
||||
|
||||
SITH_NOTIFICATIONS = [
|
||||
('NEWS_MODERATION', _("A fresh new to be moderated")),
|
||||
('FILE_MODERATION', _("New files to be moderated")),
|
||||
('SAS_MODERATION', _("New pictures/album to be moderated in the SAS")),
|
||||
('NEW_PICTURES', _("You've been identified on some pictures")),
|
||||
|
Loading…
Reference in New Issue
Block a user