(obj, objtype, default=None, prefix="")
return uid
Ensure an objects uid is unique.
Ensure an objects uid is unique.
Ensure an objects uid is unique .
def new_uid(obj, objtype, default=None, prefix=""):
    """
    Ensure an objects uid is unique.
    """
    uid = default or generate_uuid(prefix=prefix, suffix=obj.id)

    while objtype.objects.filter(uid=uid).exclude(uid=obj.uid).exists():
        uid = generate_uuid(prefix=prefix, suffix=f"{get_uuid(3)}")
    return uid
def new_uid ( obj , objtype , default = None , prefix = "" ) : uid = default or generate_uuid ( prefix = prefix , suffix = obj . id ) while objtype . objects . filter ( uid = uid ) . exclude ( uid = obj . uid ) . exists ( ) : uid = generate_uuid ( prefix = prefix , suffix = f"{get_uuid(3)}" ) return uid