~sirodoht/mataroa

781143e965acd178be10e58b81152486483d14c5 — Theodore Keloglou 9 days ago 4a9c6cb
fix when slugify cannot return string
1 files changed, 2 insertions(+), 0 deletions(-)

M main/helpers.py
M main/helpers.py => main/helpers.py +2 -0
@@ 78,6 78,8 @@ def is_disallowed(username):

def get_post_slug(post_title, owner):
    slug = slugify(post_title)
    if not slug:  # in case of post_title such as این متن است
        slug = str(uuid.uuid4())[:8]
    if models.Post.objects.filter(owner=owner, slug=slug).exists():
        slug += "-" + str(uuid.uuid4())[:8]
    return slug