Improved data ordering in requests and addes ac types CAP10

This commit is contained in:
2025-12-01 14:23:46 +01:00
parent af62bf843c
commit a31798d0b0
8 changed files with 72 additions and 20 deletions

View File

@@ -4,6 +4,7 @@ from django.db import models
from django.forms import TextInput, Textarea
from django.http import HttpRequest
from ..models.students import Student
from ..models.missions import Training
from ..models.weekpref import WeekPreference
@@ -28,8 +29,9 @@ class TrainingInLIne(nested_admin.NestedTabularInline):
# If user is a student deny edit permission for week past the current one
def has_change_permission(self, request: HttpRequest, obj: WeekPreference | None = None) -> bool:
if hasattr(request.user, 'student') and obj:
student: Student = request.user.student
current_week: int = date.today().isocalendar().week
if current_week > obj.week:
if current_week > obj.week or not student.active:
return False
return True