N
N
Nikita2022-04-06 14:48:12
Django
Nikita, 2022-04-06 14:48:12

How can I translate url addresses in django?

An example is passed to the link: "https://abc.ru/gamedev/концепция геймдев"

How to convert the url to this -> "https://abc.ru/gamedev/koncepciya-gamedev"

In fact, this is the title of the article lying in the database, but I don’t want to do the implementation through an additional column where the formative text of the finished link will already lie.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dr. Bacon, 2022-04-06
@bacon

but I don't want to do the implementation via extra column
and it is necessary, this column is called slug. Well, it’s not clear where you got such a Wishlist at all, why not immediately make a normal url, why this intermediate one?

S
Sergey Pankov, 2022-04-06
@trapwalker

Here is a detailed canonical documentation on how to do this
https://learndjango.com/tutorials/django-slug-tutorial
in terms of performance, and in terms of architecture.
I don't understand this "I don't want to". Detail the reason for this? Do you only have django for rendering static content and don't need indexing? Have you somehow deeply altered the indexes and the database so that a separate field is not needed or looks too complicated?
It seems to me that while there is not enough experience and understanding, you need to do it classically and according to the documentation. And when a deep understanding appears, either unnecessary dubious desires or questions of how to satisfy them will disappear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question