Files
WrestleDesk/backend/exercises/models.py
T
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

44 lines
1.5 KiB
Python

from django.db import models
from django.core.validators import FileExtensionValidator
class Exercise(models.Model):
CATEGORY_CHOICES = [
('warmup', 'Warm-up'),
('kraft', 'Strength'),
('technik', 'Technique'),
('ausdauer', 'Endurance'),
('spiele', 'Games'),
('cool_down', 'Cool-down'),
]
TYPE_CHOICES = [
('reps', 'Repetitions'),
('time', 'Time-based'),
]
name = models.CharField(max_length=200)
category = models.CharField(max_length=20, choices=CATEGORY_CHOICES)
exercise_type = models.CharField(max_length=10, choices=TYPE_CHOICES, default='reps')
club = models.ForeignKey('clubs.Club', on_delete=models.CASCADE, related_name='exercises', null=True, blank=True)
description = models.TextField(blank=True)
default_value = models.CharField(max_length=50, blank=True, help_text='Default reps or seconds')
media = models.FileField(
upload_to='exercises/media/',
null=True, blank=True,
validators=[FileExtensionValidator(allowed_extensions=['jpg', 'jpeg', 'png', 'mp4', '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 = ['category', 'name']
indexes = [
models.Index(fields=['category']),
models.Index(fields=['club']),
]
def __str__(self):
return f"{self.name} ({self.get_category_display()})"