Pass dict from django to JS

Global context from Django to frontend Django:

import json 
from django.conf import settings 

def backend_context(request): 
   return { 
    'backend_context': json.dumps({ }) 

You can add backend_context to your contextprocessors in (for append it in every request context) or simply add to response rendering arguments.

#django #javascript
Ivan Borshchov profile picture
Oct 31, 2016
by Ivan Borshchov
Did it help you?
Yes !

Best related