On Sat, May 30, 2015 at 5:52 PM, Emil Stenström <[email protected]> wrote: > Hi, > > This is the second feature proposal as part of my general drive for getting > Django to work better for javascript heavy sites. > > Support a javascript template language on the server > ---------------------------------------------------- > > The multiple template engine work has made it possible to switch out Django > Templates with another engine. One of the most powerful things this enables > is to use a template language that is executable both on the server and > client. > > A typical use-case for this could be that you have a list of tweets on your > site. When the user first loads the page you send the full HTML for all the > rendered tweets over. When there's a new tweet you would like to just add > that one tweet to the list, without re-rendering the whole page. Now you > have a couple of options: > > 1. Reimplement the Django template code from your site in javascript. This > is harder the more complex the template your have. Also risks bugs when you > change the server-side template but forget the client-side one. > > 2. Use Pjax, render everything on the server and send the result to the > page. This sends unnecessary data over the wire, and requires that you > figure out how to append the data in the correct location. > > 3. Send the server-side templates to the browser, and then re-render on the > client when new data arrives. This uses the least data over the wire, and > does not require that you keep track of mappings, just update the data and > re-render everything (React.js's virtual DOM can make this really fast if > you need it to be). > > Option 3 opens up lots of interesting use-cases for Django, that previously > was only possible for javascript-based frameworks.
ISTM that django already provides all these "options" (you are clearly slanting the view that "options" 1 and 2 are rubbish and only option 3 is a the valid choice..). Pluggable template engines landed in 1.8, read here for extensive details: https://myks.org/en/multiple-template-engines-for-django/ With pluggable template engines, is there anything else required in Django core to plug in whatever template language your project requires? Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CAFHbX1JeebcCzYWnESY7wEFFWpQ6WFJPJ7u4XW%3DDAcV_Um_19w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
