Let referee levels inherit from a lower level instead of relying on ordering alone

RefereeLevel.inherits_from chains levels together so a higher tier is
automatically eligible for everything a linked lower tier covers,
transitively, without hand-duplicating teams onto every level. Kept
the ordering field (still drives display order) but eligibility
everywhere (RefereeProfile.eligible_teams, events.services.referees,
the team detail page's eligible-referees list) now reads through
RefereeLevel.eligible_team_ids, which walks the inherits_from chain.
clean() rejects a loop, including an indirect one.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ECGMEwrc2k4D8VQuwjstj9
This commit is contained in:
2026-08-20 22:42:18 +02:00
parent 5889b3740e
commit 66d7de820f
10 changed files with 235 additions and 16 deletions

View File

@@ -72,10 +72,10 @@ class StaffAssignmentAdmin(admin.ModelAdmin):
@admin.register(RefereeLevel)
class RefereeLevelAdmin(admin.ModelAdmin):
list_display = ["name", "club", "ordering", "team_list"]
list_display = ["name", "club", "ordering", "inherits_from", "team_list"]
list_filter = ["club"]
search_fields = ["name"]
autocomplete_fields = ["teams"]
autocomplete_fields = ["teams", "inherits_from"]
ordering = ["club", "ordering", "name"]
@admin.display(description=_("teams"))