from django.contrib import admin
from .models import MyModel
@admin.register(MyModel)
class MyModelAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('title',)}
In Django, the `prepopulated_fields` attribute is used to
automatically populate a field based on the value of another field.
It is commonly used in the Django admin interface to generate a
value for a field based on the value entered in another field.
When you specify `prepopulated_fields` in a Django admin class,
you provide a dictionary where the keys are the fields you want to
populate and the values are the fields whose values will be
used for populating.
The `prepopulated_fields` attribute is particularly useful when you
want to generate slugs, URLs, or any other field that can be
derived from another field's value.