feat(events): event owner and cross-club validation

Add Event.created_by (the owner, used later by the access service to let an
event's creator edit it).

Validate that an event's season/location/opponent — and an EventSeries'
location/opponent — belong to the event's club. The teams M2M cannot be checked
in clean() (M2M rows are written after save), so an m2m_changed pre_add receiver
rejects teams from another club.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 14:42:17 +02:00
parent c0816a1add
commit 22d971d48c
4 changed files with 91 additions and 3 deletions

View File

@@ -0,0 +1,20 @@
# Generated by Django 6.0.6 on 2026-07-12 21:43
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0007_event_series_until'),
('members', '0002_alter_familymembership_unique_together_and_more'),
]
operations = [
migrations.AddField(
model_name='event',
name='created_by',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_events', to='members.member', verbose_name='created by'),
),
]