2 points by sebst 7 months, 3 weeks ago | 2 comments | on: Ask PN:how does pythonic News generate unique slug for Url
It's using Django's UUIDField (https://docs.djangoproject.com/en/2.2/ref/models/fields/#uuidfield). Behind the scenes, UUID4 are generated with Python's builtin uuid module. The whole point of using UUIDs is that it does not require checking for uniqueness. See for example here: https://stackoverflow.com/questions/1155008/how-unique-is-uuid


 
2 points by kas 7 months, 3 weeks ago | 1 comment | parent | on: Ask PN:how does pythonic News generate unique slug for Url
UUID4 is all fine and good. The downside of using them for unique URLs is that they're completely human unfriendly: Not only are they a PITA to remember or manually type, they are also not offering any clue whatsoever as to what the link is about. We know this site is about Python, but that is all you can deduct from seeing a URL.
 
2 points by sebst 7 months, 3 weeks ago | discuss | parent | on: Ask PN:how does pythonic News generate unique slug for Url
Completely true. However, the primary goal of this site is about sharing links and fostering discussions about it. So I thought that sharing a link about a shared link is so uncommon that UUIDs might be good enough.