Improved data ordering in requests and addes ac types CAP10
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user