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

@@ -9,6 +9,7 @@ from durationwidget.widgets import TimeDurationWidget
from ..models.hourbuildings import HourBuilding, HourBuildingLegBase, HourBuildingLegFlight, HourBuildingLegStop
from ..models.weekpref import WeekPreference
from ..models.students import Student
from datetime import date
@@ -75,8 +76,9 @@ class HourBuildingInLine(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