MSRS/events/admin.py
2021-04-18 20:58:18 +02:00

22 lines
482 B
Python

from django import forms
from django.contrib import admin
from .models import Event, EventRegistration
class RegistrationFormSet(forms.BaseInlineFormSet):
def __init__(self, *args, **kwargs):
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)