mirror of
https://github.com/ae-utbm/sith.git
synced 2026-04-22 03:03:13 +00:00
create default club roles on club creation
This commit is contained in:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user