Compare commits

..

2 Commits

Author SHA1 Message Date
Dmitry Belan 01412bc1b7 Make Submission assignment, student and status flags read-only in admin 2026-09-28 22:16:40 +03:00
Dmitry Belan 043a73fbe1 Show full question text in student answers and update late badge text 2026-09-28 22:11:36 +03:00
3 changed files with 11 additions and 3 deletions
+5
View File
@@ -107,6 +107,11 @@ class SubmissionAdmin(ModelAdmin):
search_fields = ('student__username', 'assignment__title') search_fields = ('student__username', 'assignment__title')
inlines = [AnswerInline] inlines = [AnswerInline]
def get_readonly_fields(self, request, obj=None):
if obj:
return ('assignment', 'student', 'is_time_expired', 'is_late', 'started_at', 'submitted_at')
return ('is_time_expired', 'is_late', 'started_at', 'submitted_at')
def get_queryset(self, request): def get_queryset(self, request):
qs = super().get_queryset(request) qs = super().get_queryset(request)
if request.user.is_superuser or request.user.role == 'ADMIN': if request.user.is_superuser or request.user.role == 'ADMIN':
@@ -67,7 +67,10 @@
<!-- Status indicator line --> <!-- Status indicator line -->
<div class="absolute left-0 top-0 bottom-0 w-1 {% if answer.is_correct %}bg-emerald-500{% elif answer.is_correct == False %}bg-rose-500{% else %}bg-txt-faint{% endif %}"></div> <div class="absolute left-0 top-0 bottom-0 w-1 {% if answer.is_correct %}bg-emerald-500{% elif answer.is_correct == False %}bg-rose-500{% else %}bg-txt-faint{% endif %}"></div>
<h5 class="font-medium text-sm text-txt-muted mb-3 pl-2">Задача {{ forloop.counter }}: {{ answer.question.text|striptags|truncatewords:10 }}</h5> <h5 class="font-bold text-sm text-txt-secondary mb-2 pl-2">Задача {{ forloop.counter }}</h5>
<div class="prose prose-invert max-w-none text-white text-sm mb-4 pl-2 font-body">
{{ answer.question.text|safe }}
</div>
<div class="pl-2"> <div class="pl-2">
{% if answer.question.question_type == 'TEXT_AUTO' %} {% if answer.question.question_type == 'TEXT_AUTO' %}
+2 -2
View File
@@ -48,8 +48,8 @@
{% else %} {% else %}
{% if assignment.deadline and now > assignment.deadline %} {% if assignment.deadline and now > assignment.deadline %}
{% if assignment.allow_late_submissions %} {% if assignment.allow_late_submissions %}
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-obsidian-borderLight/20 text-txt-muted border border-obsidian-borderLight/50"> <span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-accent-blue/10 text-accent-blue border border-accent-blue/30">
Дедлайн прошел Дорешивание
</span> </span>
{% else %} {% else %}
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-rose-950/40 text-rose-400 border border-rose-800/50"> <span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-rose-950/40 text-rose-400 border border-rose-800/50">