Replace django.utils.hashcompat with hashlib

django.utils.hashcompat is deprecated and removed
in Django 1.5.
Use sha1 and md5 from the hashlib module
in the Python standard library.