def ajax_request(func):
    def wrapper(request, *args, **kwargs):
        if request.method == 'POST':
            response = func(request, *args, **kwargs)
        else:
            response = {'error': {'type': 405,
                                  'message': 'Accepts only POST request'}}
        if isinstance(response, dict):
            resp = JsonResponse(response)
            if 'error' in response:
                resp.status_code = response['error'].get('type', 500)
            return resp
        return response
    wrapper.__name__ = func.__name__
    wrapper.__module__ = func.__module__
    wrapper.__doc__ = func.__doc__
    return wrapper
Test index page with login at /infrastructure/status/edit/<status_id>
dataset/ETHPy150Open montylounge/django-sugar/sugar/views/decorators.py/ajax_request--crossover with--dataset/ETHPy150Open treeio/treeio/treeio/infrastructure/tests.py/InfrastructureViewsTest.test_infrastructure_status_edit