diff --git a/cloudkittydashboard/dashboards/project/rating/views.py b/cloudkittydashboard/dashboards/project/rating/views.py index 87ee80c..f1e9139 100644 --- a/cloudkittydashboard/dashboards/project/rating/views.py +++ b/cloudkittydashboard/dashboards/project/rating/views.py @@ -52,7 +52,7 @@ class IndexView(tables.DataTableView): def quote(request): pricing = 0.0 - if request.is_ajax(): + if request.headers.get('x-requested-with') == 'XMLHttpRequest': if request.method == 'POST': json_data = json.loads(request.body) diff --git a/cloudkittydashboard/tests/test_predictive_pricing.py b/cloudkittydashboard/tests/test_predictive_pricing.py index 38c898b..8fad16b 100644 --- a/cloudkittydashboard/tests/test_predictive_pricing.py +++ b/cloudkittydashboard/tests/test_predictive_pricing.py @@ -36,7 +36,7 @@ class PredictivePricingTest(base.TestCase): def _test_quote_request_not_ajax_post(self, arg): request = mock.MagicMock() if arg == 'ajax': - request.is_ajax.return_value = False + request.headers.get.return_value = None # Not an AJAX request elif arg == 'method': request.method == 'POST' resp = self.quote(request) @@ -57,7 +57,7 @@ class PredictivePricingTest(base.TestCase): {'other_key': None, 'service': 'test_service'}] request = mock.MagicMock() - request.is_ajax.return_value = True + request.headers.get.return_value = 'XMLHttpRequest' request.method = 'POST' request.body = json.dumps(body)