django admin slug auto populate

 #models.py
from django.db import models

from django_extensions.db.fields import AutoSlugField

class MyModel(models.Model):
    title = models.CharField(max_length=42)
    slug = AutoSlugField(populate_from=['title', 'description', 'get_author_name'])

Here is what the above code is Doing:
1. It’s creating a model with a title and a slug.
2. It’s using the AutoSlugField to automatically populate the slug field.
3. It’s using the title, description, and get_author_name methods to populate the slug field.

The AutoSlugField will automatically populate the slug field whenever the title, description, or get_author_name methods are called.

If you want to use the AutoSlugField to populate the slug field, you need to add the following to your settings.py file:

AUTOSLUG_SLUGIFY_FUNCTION = ‘django_extensions.db.fields.slugify’

This will ensure that the slug field is populated whenever the title, description, or get_author_name methods are called.