don't use is_ajax
This commit is contained in:
parent
495294a886
commit
05d3530764
3 changed files with 5 additions and 3 deletions
|
@ -43,7 +43,7 @@ def sidebar_view(func=None, select_related=None, api_hybrid=False):
|
|||
request.is_delete = request.method == 'DELETE'
|
||||
return call_api_hybrid_view_for_api(func, request, *args, **kwargs)
|
||||
|
||||
ajax = request.is_ajax() or 'ajax' in request.GET
|
||||
ajax = request.headers.get('x-requested-with') == 'XMLHttpRequest' or 'ajax' in request.GET
|
||||
if not ajax:
|
||||
request.META.pop('HTTP_IF_NONE_MATCH', None)
|
||||
|
||||
|
|
|
@ -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">« {% trans 'back to c3nav' %}</a>
|
||||
{% endif %}
|
||||
<h2>{% trans 'About c3nav' %}</h2>
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue