diff --git a/com/views.py b/com/views.py
index 431ab67d..8fdc36c1 100644
--- a/com/views.py
+++ b/com/views.py
@@ -232,12 +232,10 @@ class WeekmailEditView(QuickNotifMixin, UpdateView):
if not weekmail.title:
now = timezone.now()
weekmail.title = _("Weekmail of the ") + (now + timedelta(days=6 - now.weekday())).strftime('%d/%m/%Y')
- print(self.quick_notif_list)
return weekmail
def get(self, request, *args, **kwargs):
self.object = self.get_object()
- print(self.quick_notif_list)
if 'up_article' in request.GET.keys():
art = get_object_or_404(WeekmailArticle, id=request.GET['up_article'], weekmail=self.object)
prev_art = self.object.articles.order_by('rank').filter(rank__lt=art.rank).last()
@@ -267,7 +265,6 @@ class WeekmailEditView(QuickNotifMixin, UpdateView):
art.rank = -1
art.save()
self.quick_notif_list += ['qn_success']
- print(self.quick_notif_list)
return super(WeekmailEditView, self).get(request, *args, **kwargs)
def get_context_data(self, **kwargs):
diff --git a/core/templates/core/user_tools.jinja b/core/templates/core/user_tools.jinja
index 371dcd3f..555543b7 100644
--- a/core/templates/core/user_tools.jinja
+++ b/core/templates/core/user_tools.jinja
@@ -66,6 +66,7 @@
{% trans %}Communication{% endtrans %}
{% if user.is_in_group(settings.SITH_GROUP_COM_ADMIN_ID) or user.is_root %}
+ - {% trans %}Weekmail{% endtrans %}
- {% trans %}Moderate news{% endtrans %}
- {% trans %}Edit index page{% endtrans %}
- {% trans %}Edit alert message{% endtrans %}
diff --git a/core/views/__init__.py b/core/views/__init__.py
index da9e09a2..eaa08760 100644
--- a/core/views/__init__.py
+++ b/core/views/__init__.py
@@ -147,8 +147,13 @@ class TabedViewMixin(View):
kwargs['list_of_tabs'] = self.get_list_of_tabs()
return kwargs
-class QuickNotifMixin():
+class QuickNotifMixin:
quick_notif_list = []
+
+ def dispatch(self, request, *arg, **kwargs):
+ self.quick_notif_list = [] # In some cases, the class can stay instanciated, so we need to reset the list
+ return super(QuickNotifMixin, self).dispatch(request, *arg, **kwargs)
+
def get_success_url(self):
ret = super(QuickNotifMixin, self).get_success_url()
try:
@@ -163,15 +168,12 @@ class QuickNotifMixin():
"""Add quick notifications to context"""
kwargs = super(QuickNotifMixin, self).get_context_data(**kwargs)
kwargs['quick_notifs'] = []
- print(self.quick_notif_list)
for n in self.quick_notif_list:
kwargs['quick_notifs'].append(settings.SITH_QUICK_NOTIF[n])
- self.quick_notif_list = [] # In some cases, the class can stay instanciated, so we need to reset the list
for k,v in settings.SITH_QUICK_NOTIF.items():
for gk in self.request.GET.keys():
if k == gk:
kwargs['quick_notifs'].append(v)
- print(self.quick_notif_list)
return kwargs