'The 404 page should have the csrf_token available in the context'

def test_csrf_token_in_404(self):

    old_DEBUG = settings.DEBUG
    try:
        settings.DEBUG = False
        for url in self.non_existing_urls:
            response = self.client.get(url)
            csrf_token = response.context['csrf_token']
            self.assertNotEqual(str(csrf_token), 'NOTPROVIDED')
            self.assertNotEqual(str(csrf_token), '')
    finally:
        settings.DEBUG = old_DEBUG
