This has nothing to do with Python vs PHP.
This is a conscious decision by the authors of Django to limit what can be done in a template - a decision that I whole-heartedly agree with.
For more on this opinion see: Alternative to Django Template Engine? - #3 by KenWhitesell
If you find this design decision to be too limiting for you, you always have the options of either using a different template engine, extending the current engine, or adding your own custom tags to do stuff like this on your own.