from django.contrib import admin from django import forms from .models import Event, EventRegistration class RegistrationFormSet(forms.BaseInlineFormSet): def __init__(self, *args, **kwargs): kwargs["initial"] = [ {"state": EventRegistration.ADMITTED} ] super().__init__(*args, **kwargs) class RegistrationInline(admin.TabularInline): model = EventRegistration extra = 1 formset = RegistrationFormSet class EventAdmin(admin.ModelAdmin): inlines = [RegistrationInline] admin.site.register(Event, EventAdmin)