I was trying to set the initial value for a choice field in the admin like this: from django import forms from django.contrib import admin from mptt.admin import MPTTModelAdmin from author.models import Author from serials.constants import STATUS_CHOICES class AuthorAdminForm(forms.ModelForm): class Meta: model = Author class AuthorAdmin(MPTTModelAdmin): form = AuthorAdminForm(initial={'status': STATUS_CHOICES[0][0]}) admin.site.register(Author, AuthorAdmin) Logically, I should […]
↧