diff --git a/hawk/settings/base.py b/hawk/settings/base.py index 86dcac7..65f0f46 100644 --- a/hawk/settings/base.py +++ b/hawk/settings/base.py @@ -103,3 +103,7 @@ MAINTENANCE_MODE_STATE_FILE_PATH = "maintenance" MAINTENANCE_MODE_RETRY_AFTER = 60 # one minute + +HAWK = { + "SLUG_LENGTH": 8 +} diff --git a/hawk_gui/models.py b/hawk_gui/models.py index f27634b..9c13d59 100644 --- a/hawk_gui/models.py +++ b/hawk_gui/models.py @@ -1,6 +1,7 @@ import random - import string + +from django.conf import settings from django.db import models from django.urls import reverse_lazy from django.utils.html import format_html @@ -140,7 +141,7 @@ def save(self, **kwargs): slug = "".join( random.choices( string.ascii_lowercase + string.digits, - k=self._meta.get_field("slug").max_length, + k=settings.HAWK['SLUG_LENGTH'], ) ) # We said unique slug