Fixes for Django v1.6