23 lines
482 B
Python
23 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)
|