mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 03:13:12 +00:00
Check to avoid multiple messages
This commit is contained in:
parent
c931ec9fa0
commit
e2c2ce6b18
1 changed files with 5 additions and 2 deletions
|
@ -26,6 +26,7 @@ from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
from django.contrib.messages import get_messages
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from preferences.models import GeneralOption, OptionalMachine
|
from preferences.models import GeneralOption, OptionalMachine
|
||||||
from django.utils.translation import get_language
|
from django.utils.translation import get_language
|
||||||
|
@ -47,8 +48,10 @@ def context_user(request):
|
||||||
global_message = GeneralOption.get_cached_value("general_message_en")
|
global_message = GeneralOption.get_cached_value("general_message_en")
|
||||||
if global_message:
|
if global_message:
|
||||||
if isinstance(request, HttpRequest):
|
if isinstance(request, HttpRequest):
|
||||||
|
if global_message not in [msg.message for msg in get_messages(request)]:
|
||||||
messages.warning(request, global_message)
|
messages.warning(request, global_message)
|
||||||
else:
|
else:
|
||||||
|
if global_message not in [msg.message for msg in get_messages(request._request)]:
|
||||||
messages.warning(request._request, global_message)
|
messages.warning(request._request, global_message)
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
interfaces = user.user_interfaces()
|
interfaces = user.user_interfaces()
|
||||||
|
|
Loading…
Reference in a new issue