Files
Andrej Spielmann 3fefc550fe Initial commit: WrestleDesk full project
- Django backend with DRF (clubs, wrestlers, trainers, exercises, templates, trainings, homework, locations, leistungstest)
- Next.js 16 frontend with React, Shadcn UI, Tailwind
- JWT authentication
- Full CRUD for all entities
- Calendar view for trainings
- Homework management system
- Leistungstest tracking
2026-03-26 13:24:57 +01:00

30 lines
1.1 KiB
Python

from django.db import models
from django.core.validators import FileExtensionValidator
class Trainer(models.Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
club = models.ForeignKey('clubs.Club', on_delete=models.CASCADE, related_name='trainers')
email = models.EmailField(blank=True)
phone = models.CharField(max_length=50, blank=True)
photo = models.ImageField(
upload_to='trainers/photos/',
null=True, blank=True,
validators=[FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'png', 'webp'])]
)
is_active = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['last_name', 'first_name']
def __str__(self):
return f"{self.first_name} {self.last_name}"
# Note: Name uniqueness per club is not enforced at the database level.
# If the same trainer works for multiple clubs, they would appear once per club.
# If unique names per club are required, add: unique_together = ['first_name', 'last_name', 'club']