don't use is_ajax

This commit is contained in:
Laura Klünder 2022-04-03 17:52:05 +02:00
parent 495294a886
commit 05d3530764
3 changed files with 5 additions and 3 deletions

View file

@ -3,7 +3,7 @@
{% block content %}
<main class="account">
{% if not request.mobileclient and not request.is_ajax %}
{% if not request.mobileclient and not ajax %}
<a href="{% url 'site.index' %}" class="float-right">&laquo; {% trans 'back to c3nav' %}</a>
{% endif %}
<h2>{% trans 'About c3nav' %}</h2>

View file

@ -192,7 +192,8 @@ def qr_code(request, path):
def close_response(request):
ajax = request.is_ajax() or 'ajax' in request.GET
# todo: use a better way to recognize this
ajax = request.headers.get('x-requested-with') == 'XMLHttpRequest' or 'ajax' in request.GET
if ajax:
return HttpResponse(json.dumps(get_user_data(request), cls=DjangoJSONEncoder).encode(),
content_type='text/plain')
@ -355,6 +356,7 @@ def choose_language(request):
@never_cache
def about_view(request):
return render(request, 'site/about.html', {
'ajax': request.headers.get('x-requested-with') == 'XMLHttpRequest' or 'ajax' in request.GET,
'address': settings.IMPRINT_ADDRESS,
'patrons': settings.IMPRINT_PATRONS,
'team': settings.IMPRINT_TEAM,