3 ms·
I think in most cases when you add a feature you end up touching everything in each of the layers. It's only when you want to change something that it's possib
by vikram 18y ago
I think in most cases when you add a feature you end up touching everything in each of the layers.
It's only when you want to change something that it's possible that you might just be restricted to one layer.
I think the idea of the template is that you have one template and many views, and possibly that a template can be created of many different smaller templates, e.g. header, footer, sidebar.
Here is an example of something that I wanted to do with a very specific template that wouldn't be used on any other page.
My model gives distance in meters, for each of the objects and I wanted to display it in miles. So I had to add a new method to the model dist_miles. Instead of just saying round(cinema.dist / 1600, 2) in the template.
I've only been using django for a week now so its quite possible that I'm going about it all wrong.
- GrumpySimon 18y agoYep, all wrong :) You want a custom filter: http://www.djangoproject.com/documentation/templates_python/ http://www.djangoproject.com/documentation/templates_python/
- mrtron 18y agoOther types of complexity can be handled in custom template tags too. The easy way to look at them is you could write your own 'filter' or 'count' or any of the tags you see. However, most of your needs can be met by the built in filters.