create default club roles on club creation

This commit is contained in:
imperosol
2026-04-19 14:43:37 +02:00
parent 937f1e2535
commit 9b862cfefc
5 changed files with 153 additions and 3 deletions
+13
View File
@@ -13,6 +13,8 @@
#
#
from django.contrib import admin
from django.forms.models import ModelForm
from django.http import HttpRequest
from club.models import Club, ClubRole, Membership
@@ -29,6 +31,17 @@ class ClubAdmin(admin.ModelAdmin):
"page",
)
def save_model(
self,
request: HttpRequest,
obj: Club,
form: ModelForm,
change: bool, # noqa: FBT001
):
super().save_model(request, obj, form, change)
if not change:
obj.create_default_roles()
@admin.register(ClubRole)
class ClubRoleAdmin(admin.ModelAdmin):