Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k 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 (106k 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

0 votes
1 answer
0 votes
1 answer
asked Nov 28, 2020 in Python by Rekha (2.2k points)

Browse Categories

...