Django template block name changing function
This seems valid, and I don't think it should mess up Django's functionality.
Some improvements are possible.



This is not Pythonic:


if len(extend_nodes) == 0:
    return



Write like this:

if not extend_nodes:
    return




This is not Pythonic:


    if blocks.has_key(name):
        # ...



Write like this:

    if name in blocks:
        # ...


But...

You're not supposed to do this.
You haven't explained why you want to change template block names on the fly.
And I cannot think of a legitimate use case.
It's inefficient to do this operation on the fly,
for every page load.
What you should really do instead is update the template files in your project,
do the necessary renames once and save it,
so that you don't need this unnecessary extra operation.
The end result will be more efficient, and more robust.
Updating all files in your project is possible with a little scripting.