updated to make it use with django1.6