MSRS/events/admin.py

23 lines
482 B
Python
Raw Normal View History

2021-04-18 20:58:18 +02:00
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)