What is a “slug” in Django?

前端 未结 10 1783
感情败类
感情败类 2020-11-22 14:59

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 th

10条回答
  •  执念已碎
    2020-11-22 15:20

    slug

    A short label for something, containing only letters, numbers, underscores or hyphens. They’re generally used in URLs. For example, in a typical blog entry URL:

    https://www.djangoproject.com/weblog/2008/apr/12/spring/ the last bit (spring) is the slug.

提交回复
热议问题