A
A
alxxla2020-05-04 14:28:47
Django
alxxla, 2020-05-04 14:28:47

How to implement automatic slug generation for an article?

I need to automate the creation of a slug for an article. that is, the machine should take the last created article, take the slug (number) from it and add 1. How can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dr. Bacon, 2020-05-04
@alxxla

So the slug is not about that. And so, get the counter field and count it, just keep in mind that there may be collisions when working simultaneously. And better do it right:
https://docs.djangoproject.com/en/3.0/ref/utils/#d...
https://docs.djangoproject.com/en/3.0/ref/contrib/...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question