For compatibility with older python version, in django.utils.hashcompat there is a sha_constructor that can be used specifically for this.
value = sha.new(request.POST.get(self.key_field, '')).hexdigest()
from django.utils.hashcompat import sha_constructor
value = sha_constructor(request.POST.get(self.key_field, '')).hexdigest()
For compatibility with older python version, in django.utils.hashcompat there is a sha_constructor that can be used specifically for this.
So,
could be replaced with:
http://code.djangoproject.com/browser/django/trunk/django/utils/hashcompat.py