Pre-populate fields in Django admin

Django, Python

Pre-populate fields' text based on the content of another field in Django admin

Set prepopulated_fields to a dictionary mapping field names to the fields it should prepopulate from:

py

class ArticleAdmin(admin.ModelAdmin): prepopulated_fields = {"slug": ["title",]}

prepopulated_fields doesn’t accept DateTimeField, ForeignKey, OneToOneField, and ManyToManyField fields.


Source