inlined a function missing in django1.5