I have this change password request form.In which the user enter their oldpasswords.
this oldpassword is the md5 format.
How to compare the md5 value from db
the hash you put in there is a salted sha1 hexdigest as django (and probably many others) stores it by default.
the code to verify it is in contrib/auth/models.py. From there you can see that django works with md5 by default. All you have to do is to update the old hashes to the following form:
md5$$
if your hashes aren't salted yet leave the salt empty (md5$$
), but update the hash to sha1 the next time the user performs a valid login.