-1

I am beginning to learn Django and get this data related "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.

Why do we need this and how to use?

Community
  • 1
  • 1
keren rev
  • 3
  • 1

1 Answers1

0

Slug it's a way of generating a valid URL. Its advise to generate the slug, rather than setting it manually.

Example:

 slug = models.SlugField(max_length=30)
Adi Ep
  • 333
  • 2
  • 16