P
P
Pavel Dyukarev2018-12-14 16:31:33
Django
Pavel Dyukarev, 2018-12-14 16:31:33

How to generate a unique link to content?

Guys, share your experience! What is the EASIEST way to create a unique reference to an object of the type in DJANGO:
https://coub.com/view/13kcf0
I can’t find consistent examples (at least in words). Just snippets of information.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2018-12-14
@PavelDuk

take the record id/etc and convert it from a decimal system to a system with a higher base/alphabet.
usually base62 or base64 is used (replacing +/ with -_ for use in url).
or use libraries like hashids, which will additionally give randomization.
when requesting such a link, we convert again to a decimal id and get the desired content.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question