8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-26 08:53:46 +00:00

Fix messages for usage in API

This commit is contained in:
Charlie Jacomme 2018-08-11 04:14:13 +02:00 committed by chirac
parent 771e8cc3fa
commit 80708e872e

View file

@ -26,7 +26,7 @@ from __future__ import unicode_literals
import datetime
from django.contrib import messages
from django.http import HttpRequest
from preferences.models import GeneralOption, OptionalMachine
from django.utils.translation import get_language
@ -40,7 +40,10 @@ def context_user(request):
else:
global_message = GeneralOption.get_cached_value('general_message_en')
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():
interfaces = user.user_interfaces()
else: