'Verify the response contains error message.'

def verify_error_message(self, data, error_message):

    response = self.client.post(self.view_url, data=data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertContains(response, error_message, status_code=200)
