2 ms·
If you have talented folks, #1 shouldn't be a concern. On the contrary; we don't expect programmers to master design and become Photoshop gurus, for example, s
by ubernostrum 17y ago
If you have talented folks, #1 shouldn't be a concern.
On the contrary; we don't expect programmers to master design and become Photoshop gurus, for example, so why should we expect designers to master what is, essentially, programming? There's a lot to be said for having different groups of people whose strengths are in particular domains.
If you have a view which fetches some data, that same view should be re-usable for an API as json or xml or whatever you choose.
Actually, this only works in the most trivial (and thus non-real-world) of situations. Usually, API access needs to be mediated through additional logic (authentication, access control, rate limiting, etc.).
Forcing all of that logic into template tags is just silly.
I have to admit that I don't really know what you're getting at here. If you do have a case that's as simple as "use another template", well, you use another template. If you don't, no amount of program logic in templates is going to save you.
Anyway, here's how I see it:
1. Django's template language is designed to permit enough logic to handle presentation, and to be easily extensible for cases where you need something more.
2. Jinja is designed to permit quite a lot of free-form programming constructs, and is not particularly easy to extend when you run up against a wall.
These are fundamentally different approaches to "templating", and what I've found is that people who prefer, say, Jinja tend to just use it and move on. The people who stick around to argue are the ones who think that some particular tag or extra bit of logic should be made available by default in Django, and so are arguing about differences of degree rather than differences of kind.