Categories
Python Answers

How to create a slug in Python Django?

Spread the love

Sometimes, we want to create a slug in Python Django, we can use the slugify function.

In this article, we’ll look at how to create a slug in Python Django, we can use the slugify function.

How to create a slug in Python Django?

To create a slug in Python Django, we can use the slugify function.

For instance, we write

from django.template.defaultfilters import slugify
slugify("b b b b")

to call slugify to return a string with the spaces between the b’s filled dashes.

Conclusion

To create a slug in Python Django, we can use the slugify function.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *