Pre-populate fields in Django admin
Django, Python
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 acceptDateTimeField
,ForeignKey
,OneToOneField
, andManyToManyField
fields.