I am new to developing a website and because of my familiarity with Python and considering the complexity of the website, I chose Django.
I want to know the best practice for developing a template through the Django framework. My question is two-fold.
- Is it best to have a bunch of for loops / if statements in the template using template tags and other features of Django?
- Or is it passing the variables from Django to Javascript through JSON and then loading the page asynchronously?
For the first, I found the following merits: its fairly easy. I know what I want, I code the loops and I get the result that I expect. Plus giving IDs / names to HTML tags is super simple. Inline scripting also becomes simple, but I personally dont like it. But as objects start to get high in number, page load speed suffers.
For the second, and I am very new to this, the ease is gone. There is, I feel, another hoop to jump through Javascript, with JSON parsing and then the actual modeling.
If not either first or second, may be there is a balance between the two? All help is appreciated.