Answer the question
In order to leave comments, you need to log in
How to automatically generate an article URL?
It is necessary to implement URL generation for the written article. That is, when creating any article ( so far only in the admin panel ), it is necessary that after pressing the Save button , the URL for this article would be automatically generated.
There is a piece of code for generation. I did the same operation, but on Flask and it worked:
def slugify(s):
pattern = r'[^\w+]'
return re.sub(pattern, '-', s)
Answer the question
In order to leave comments, you need to log in
option 1
slug = models.SlugField()
option 2
pip install transliterate
...
from transliterate import slugify
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question