mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-27 01:13:46 +00:00
Fix messages for usage in API
This commit is contained in:
parent
771e8cc3fa
commit
80708e872e
1 changed files with 5 additions and 2 deletions
|
@ -26,7 +26,7 @@ from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
|
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
|
||||||
|
|
||||||
|
@ -40,7 +40,10 @@ def context_user(request):
|
||||||
else:
|
else:
|
||||||
global_message = GeneralOption.get_cached_value('general_message_en')
|
global_message = GeneralOption.get_cached_value('general_message_en')
|
||||||
if global_message:
|
if global_message:
|
||||||
messages.warning(request, global_message)
|
if isinstance(request, HttpRequest):
|
||||||
|
messages.warning(request, global_message)
|
||||||
|
else:
|
||||||
|
messages.warning(request._request, global_message)
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
interfaces = user.user_interfaces()
|
interfaces = user.user_interfaces()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue