I want to use unique hashes for each model rather than ids.
I implemented the following function to use it across the board easily.
import random,hashlib
Use your database engine's UUID support instead of making up your own hash. Almost everything beyond SQLite supports them, so there's little reason to not use them.