Django: How can I find methods/functions filling in the specific template
Determining template variable resolution is all about Context.

Use the URL to identify the view being invoked.
Look at the view's return and note a) the template being used, and b) any values being passed in the Context used when the template is being rendered.
Look at settings.py for the list of TEMPLATE_CONTEXT_PROCESSORS. These are routines that are called automatically and invisibly to add values to the Context being passed to the template. This is sort of a Man Behind the Curtain™ process that can really trip you up if you don't know about it.
Check to see if there are any magic template tags being called (either in the template in question, in a template it extends, or in a template that includes the template) that might be modifying the Context. Sometimes I need use an old-school django snippet called {%expr%} that can do evaluation in the template, but I always use it as close to the point of need as possible to highlight the fact it is being used.

Note that because of the way Django template variables are resolved, {{foo.something}} could be either a value or a callable method. I have serious issues with this syntax, but that's the way they wrote it.
Say, I find some bug in a web interface. I open firebug and discover element and class, id of this element. By them I can then identify a template which contains variables, tags and so on.
How can I move forward and reveal in which .py files these variables are filled in?
I know how it works in Lift framework: when you've found a template there are elements with attributes bound to snippets. So you can easily proceed to specific snippets and edit code.
How does it work in django? May be, I suppose wrong process... then point me to the right algorithm, please.