slugify to a max of 50 and remove date
This commit is contained in:
@@ -172,7 +172,7 @@ class Topics(Model):
|
||||
name = name.strip()
|
||||
description = description.strip()
|
||||
now = int(time.time())
|
||||
slug = f'{slugify(name)}-{now}'
|
||||
slug = slugify(name, max_length=50)
|
||||
|
||||
topic_count = Topics.count()
|
||||
return Topics.create({
|
||||
@@ -287,7 +287,7 @@ class Threads(Model):
|
||||
def new(cls, user_id: int, topic_id: int, title: str, content: str, language: str = 'babycode') -> Threads:
|
||||
from slugify import slugify
|
||||
now = int(time.time())
|
||||
slug = f'{slugify(title)}-{now}'
|
||||
slug = slugify(title, max_length=50)
|
||||
thread = Threads.create({
|
||||
'topic_id': topic_id,
|
||||
'user_id': user_id,
|
||||
|
||||
Reference in New Issue
Block a user