Hash the password if being changed

def pre_save(sender, model):
    """ Hash the password if being changed """

    if isinstance(model, Model) and 'password' in model.dirty_fields:
        model.salt, model.password = gen_salt_and_hash(model.password)