Skip to content
Advertisement

How to auto generate slug from my Album model in django 2.0.4

I have an Album field with a list of Songs

JavaScript

I would like to know how to generate slugs from the album title. I am following a tutorial which is using django 1.8 which uses regular expressions to implement this task. But from looking through the documentation they have introduced a more simpler approach (”). So can you help explain how I can implement it for a beginner to understand not only in this context but if possible across board. Thanks in advance.

Advertisement

Answer

Django autogenerates the slug from the string object you pass to the slug field.

JavaScript
Advertisement