first commit

This commit is contained in:
vanalmsick 2025-09-27 18:19:06 +01:00
commit e7f627801f
152 changed files with 35352 additions and 0 deletions

View file

@ -0,0 +1,53 @@
from django.contrib import admin
from .models import Competition, ActivityGoal, Team, Award
from custom_user.models import CustomUser
# Register your models here.
class ActivityGoalInline(admin.TabularInline):
"""Table of Competition ActivityGoal"""
model = ActivityGoal
fk_name = "competition"
can_delete = False
extra = 0
class AwardsInline(admin.TabularInline):
"""Table of Awards"""
model = Award
fk_name = "competition"
can_delete = False
extra = 0
class TeamInline(admin.TabularInline):
"""Table of Competition teams"""
model = Team
fk_name = "competition"
can_delete = False
extra = 0
@admin.register(Competition)
class CompetitionAdmin(admin.ModelAdmin):
"""Admin view of Competition - the highest level e.g. Football World Cup 2024"""
def has_delete_permission(self, request, obj=None):
"""Block admins form deleting a Tournament"""
return False
list_display = [
"name",
"start_date",
"end_date",
]
inlines = [
ActivityGoalInline,
AwardsInline,
TeamInline,
]