diff --git a/app/models/order.py b/app/models/order.py index 1405563..3d9f84a 100644 --- a/app/models/order.py +++ b/app/models/order.py @@ -11,9 +11,11 @@ from utils import first from .database import db from .user import User +BASE58_ALPHABET = \ + b'123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' + def generate_slug(): - alphabet = string.ascii_letters + string.digits - secret = ''.join(secrets.choice(alphabet) for i in range(7)) + secret = ''.join(secrets.choice(BASE58_ALPHABET) for i in range(7)) while Order.query.filter(Order.slug == secret).first() is not None: secret = ''.join(secrets.choice(alphabet) for i in range(7)) return secret