Commit 80708e87 authored by Charlie Jacomme's avatar Charlie Jacomme Committed by chirac

Fix messages for usage in API

parent 771e8cc3
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment