support django >=1.6
fixing possible errors on pypy2