0 votes
1 view
in Python by (47.8k points)

When I read Django code I often see in models what is called a "slug". I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing supposed to be used?

1 Answer

0 votes
by (107k points)

The term 'slug' which is used in Django comes from the world of newspaper editing:-

So this name is an informal name that is given to a story during the production process. As the story winds its tortuous path from beat reporter through to editor through to the "printing presses", this is the name it is referenced by, e.g., "Have you fixed those errors in the 'Russia-cuts-Europe-gas' story?".

So Django uses “slug” as part of the URL to locate the story, an example being:-

 www.mysite.com/archives/russia-cuts-europe-gas

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...