title: Django receiving json post request from external source
body: <p>I have written a view function that processes a post request containing json data from a source outside of django (labview). I'm just testing it to begin with so it looks like this</p>
  
  <pre><code>def post_entry(request):
      '''Process incoming json string
      '''
  
      if request.method == 'POST':
  
          post_data = request.body
  
      # Return a response
      return HttpResponse('data received OK')
  </code></pre>
  
  <p>I've written a test to test this and it passes fine:</p>
  
  <pre><code>def test_post_entry_view_good_post_data(self):
      '''post_entry view should return a 200 status if valid
      '''
  
      data = {'DHTP Data': ['10', '50.296', '50.94', '50.418', '50.425', '50.431', '50.94'],
          'Test String': 'My Test String'}
  
      request_url = reverse('post_entry') 
      response = self.client.post(request_url, content_type='application/json', 
          data=dumps(data))
  
      # Should return a 200 response indicating ok
      self.assertEqual(response.status_code, 200)
  </code></pre>
  
  <p>But when labview posts the data <code>post_entry</code> returns a 403 forbidden error. I guess this is due to no csrf token being present, but why does the test pass in this case?</p>