diff --git a/core/views/__init__.py b/core/views/__init__.py
index c682ec71..da9e09a2 100644
--- a/core/views/__init__.py
+++ b/core/views/__init__.py
@@ -147,6 +147,34 @@ class TabedViewMixin(View):
kwargs['list_of_tabs'] = self.get_list_of_tabs()
return kwargs
+class QuickNotifMixin():
+ quick_notif_list = []
+ def get_success_url(self):
+ ret = super(QuickNotifMixin, self).get_success_url()
+ try:
+ if '?' in ret:
+ ret += '&' + self.quick_notif_url_arg
+ else:
+ ret += '?' + self.quick_notif_url_arg
+ except: pass
+ return ret
+
+ def get_context_data(self, **kwargs):
+ """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
+
+
from .user import *
from .page import *
from .files import *
diff --git a/sith/settings.py b/sith/settings.py
index e2afe980..11dbdb9c 100644
--- a/sith/settings.py
+++ b/sith/settings.py
@@ -466,6 +466,13 @@ SITH_NOTIFICATIONS = [
('GENERIC', _("You have a notification")),
]
+SITH_QUICK_NOTIF = {
+ 'qn_success': _("Success!"),
+ 'qn_fail': _("Fail!"),
+ 'qn_weekmail_new_article': _("You successfully posted an article in the Weekmail"),
+ 'qn_weekmail_article_edit': _("You successfully edited an article in the Weekmail"),
+ }
+
try:
from .settings_custom import *
print("Custom settings imported")