Skip to content

Commit

Permalink
We still generate short slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
AmauryCarrade committed Apr 17, 2021
1 parent 825cc1f commit 3e97f84
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions hawk/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@

MAINTENANCE_MODE_STATE_FILE_PATH = "maintenance"
MAINTENANCE_MODE_RETRY_AFTER = 60 # one minute

HAWK = {
"SLUG_LENGTH": 8
}
5 changes: 3 additions & 2 deletions hawk_gui/models.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e97f84

Please sign in to comment.