fixes for old django versions, 1.4+3.0