2 Answers
2

The Django team has decided, as a matter of philosophy, not to allow passing method parameters in a view. Personally, I agree with them; it forces a separation of logic and presentation that I find helpful. It prevents the kind of spaghetti code that PHP is notorious for.

The right thing to do in the case you linked is to pass the result of that call from the view into the template via the context. It's just more maintainable that way. If later you need to change my_related_deltas(3) to my_related_deltas(4), you go to the view, which should be fairly concise, instead of searching through templates to figure out exactly where it is defined.

Well, the nice thing is that they don't tie you to it. I know a few people who use Jinja2 (jinja.pocoo.org/2/documentation) for their templates instead of the Django template system. Apparently it's pretty easy to switch out and use instead.
–
tghwOct 7 '09 at 5:38