Re: Best practice for passing JSON objects to a template

2015-04-24 Thread Piper Merriam
Look at django-argonauts https://github.com/fusionbox/django-argonauts It provides a nice (safe) template tag you can use to filter json serializable python objects into safe javascript objects. On Thursday, April 9, 2015 at 11:50:50 AM UTC-6, Eric Plumb wrote: > > Hi Djangoers! > > Sometimes i

Re: Best practice for passing JSON objects to a template

2015-04-24 Thread florent . pastor
I guess both methods are valid. Method one could be useful if it makes sense to have a data attribute. Although, if it makes sense to have a data attribute filled up with JSON, and if the json is simple enough, then you can surely convert the json file to "data-" element (for exemple, {"name" :

Re: Best practice for passing JSON objects to a template

2015-04-22 Thread Mario Gudelj
I often use method 2. I don't see a problem with it. On 10 April 2015 at 02:08, Eric Plumb wrote: > Hi Djangoers! > > Sometimes in the course of human events it becomes necessary to encode a > JSON object directly into a template. We all prefer AJAX and REST APIs and > the rest of the TOFLAs, b

Re: Best practice for passing JSON objects to a template

2015-04-22 Thread Ilya Kazakevich
What about putting it into ? On Thursday, April 9, 2015 at 8:50:50 PM UTC+3, Eric Plumb wrote: > > Hi Djangoers! > > Sometimes in the course of human events it becomes necessary to encode a > JSON object directly into a template. We all prefer AJAX and REST APIs and > the rest of the TOFLAs, bu