I want to keep track of user password change history, and display a warning if their current password is used by them before. To note, I don't want to prevent a user from setting a password if it is used before, I want to let them set the password, but just display a warning afterwards. So what I'm looking for is NOT a password validator.
I know that while Django saves user passwords in the db, it creates a hash of the password, using a random salt. So 2 hashes of the same password will not be the same. Still, is it possible to tell if 2 different password hashes are created with the same raw password as the input?
If you don't have access to the plaintext password and all you have are the hashes, you cannot make any comparisons between them. That's precisely on purpose to make the passwords irreversible, and especially entire databases of them. You may be able to brute-force one password given enough time and computing power, but you can't apply that knowledge to any other hashes, so brute-forcing an entire database of them is prohibitively expensive.
You could make such comparisons at the time of registration, login or password reset, when the user has input their plain password. At that point, you just need to hash the password with the salt of the existing one(s) and then compare the hashes.