This commit is contained in:
Dmitry Belan
2026-09-19 11:43:07 +03:00
commit 0e11a41d29
47 changed files with 1631 additions and 0 deletions
@@ -0,0 +1,85 @@
{% extends "admin/change_list.html" %}
{% load i18n admin_urls static admin_list unfold_list %}
{% block result_list %}
{% if actions_on_top %}
{% if cl.search_fields or action_form or cl.has_filters %}
<div class="bg-gray-50 flex flex-col gap-3 mb-4 p-3 rounded-md lg:flex-row dark:bg-gray-800">
{% block search %}
{% search_form cl %}
{% endblock %}
{% block filters %}
{% if cl.has_filters %}
<a class="{% if cl.has_active_filters %}bg-primary-600 border-primary-600 text-white{% else %}bg-white dark:bg-gray-900 dark:border-gray-700{% endif %} border cursor-pointer flex font-medium group items-center px-3 py-2 rounded-md shadow-sm text-sm lg:ml-auto md:mt-0 {% if not cl.model_admin.list_filter_sheet %}2xl:hidden{% endif %}" x-on:click="filterOpen = true" x-on:keydown.escape.window="filterOpen = false">
{% trans "Filters" %}
<span class="material-symbols-outlined md-18 ml-auto -mr-1 pl-4 {% if cl.has_active_filters %}text-white{% else %}text-gray-400 group-hover:text-gray-500 dark:group-hover:text-gray-400 dark:text-gray-500{% endif %}">filter_list</span>
</a>
{% endif %}
{% endblock %}
</div>
{% endif %}
{% endif %}
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 mt-4 pb-8">
<!-- PENDING COLUMN -->
<div class="bg-gray-50 dark:bg-gray-800 rounded-lg p-4 shadow-sm border border-gray-200 dark:border-gray-700">
<h2 class="font-bold text-lg mb-4 text-gray-700 dark:text-gray-300 flex items-center">
<span class="w-3 h-3 bg-yellow-400 rounded-full mr-2"></span>
Ожидает проверки
</h2>
<div class="flex flex-col gap-3">
{% for result in cl.result_list %}
{% if result.status == 'PENDING' %}
<div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-4 rounded-lg shadow-sm hover:shadow-md transition-shadow relative overflow-hidden group">
<div class="absolute top-0 left-0 w-1 h-full bg-yellow-400"></div>
<h3 class="font-semibold text-gray-900 dark:text-white text-base pl-2">{{ result.assignment.title }}</h3>
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400 pl-2">
<p class="flex items-center gap-1 mb-1"><span class="material-symbols-outlined text-[16px]">person</span> {{ result.student.first_name|default:result.student.username }}</p>
<p class="flex items-center gap-1"><span class="material-symbols-outlined text-[16px]">schedule</span> {{ result.submitted_at|date:"d M Y, H:i" }}</p>
</div>
<div class="mt-4 pl-2">
<a href="{% url 'admin:lms_submission_change' result.pk %}" class="inline-flex items-center px-3 py-1.5 border border-transparent text-xs font-medium rounded text-white bg-primary-600 hover:bg-primary-700 transition">
Проверить &rarr;
</a>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
<!-- GRADED COLUMN -->
<div class="bg-gray-50 dark:bg-gray-800 rounded-lg p-4 shadow-sm border border-gray-200 dark:border-gray-700">
<h2 class="font-bold text-lg mb-4 text-gray-700 dark:text-gray-300 flex items-center">
<span class="w-3 h-3 bg-green-500 rounded-full mr-2"></span>
Проверено
</h2>
<div class="flex flex-col gap-3">
{% for result in cl.result_list %}
{% if result.status == 'GRADED' %}
<div class="bg-white dark:bg-gray-900 border border-gray-200 dark:border-gray-700 p-4 rounded-lg shadow-sm hover:shadow-md transition-shadow relative overflow-hidden group">
<div class="absolute top-0 left-0 w-1 h-full bg-green-500"></div>
<h3 class="font-semibold text-gray-900 dark:text-white text-base pl-2">{{ result.assignment.title }}</h3>
<div class="mt-2 text-sm text-gray-600 dark:text-gray-400 pl-2">
<p class="flex items-center gap-1 mb-1"><span class="material-symbols-outlined text-[16px]">person</span> {{ result.student.first_name|default:result.student.username }}</p>
<p class="flex items-center gap-1 font-medium text-green-600 dark:text-green-400"><span class="material-symbols-outlined text-[16px]">done_all</span> Оценка: {{ result.grade|default:"-" }}</p>
<p class="flex items-center gap-1 mt-1 text-xs"><span class="material-symbols-outlined text-[14px]">event</span> {{ result.submitted_at|date:"d M Y, H:i" }}</p>
</div>
<div class="mt-4 pl-2">
<a href="{% url 'admin:lms_submission_change' result.pk %}" class="inline-flex items-center px-3 py-1.5 border border-gray-300 dark:border-gray-600 text-xs font-medium rounded text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 transition">
Посмотреть &rarr;
</a>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% block pagination %}
{% pagination cl %}
{% endblock %}
{% endblock %}
@@ -0,0 +1,108 @@
{% extends 'lms/base.html' %}
{% block title %}{{ assignment.title }} | ЕГЭ LMS{% endblock %}
{% block content %}
<div class="mb-8">
<a href="{% url 'lms:dashboard' %}" class="text-blue-600 hover:underline mb-4 inline-block">&larr; Назад к списку</a>
<h1 class="text-3xl font-bold text-gray-900">{{ assignment.title }}</h1>
<div class="mt-2 text-sm text-gray-500 flex gap-4">
<span>Предмет: {{ assignment.subject.name }}</span>
</div>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-6 mb-8">
<h3 class="text-xl font-semibold mb-4">Описание задания</h3>
<div class="prose max-w-none text-gray-700">
{{ assignment.description|safe }}
</div>
</div>
<div class="bg-white rounded-2xl shadow-sm border border-gray-100 p-6">
<h3 class="text-xl font-semibold mb-4">Ваш ответ</h3>
{% if submission %}
<div class="mb-6 p-4 rounded-lg border {% if submission.status == 'GRADED' %}bg-green-50 text-green-800 border-green-200{% else %}bg-yellow-50 text-yellow-800 border-yellow-200{% endif %}">
{% if submission.status == 'GRADED' %}
<h4 class="font-bold mb-2">Оценка: {{ submission.grade|default:"Не выставлена" }}</h4>
{% else %}
<p>Ваша работа отправлена и ожидает проверки.</p>
{% endif %}
{% if submission.teacher_feedback %}
<p class="mt-2"><strong>Общий комментарий:</strong> {{ submission.teacher_feedback }}</p>
{% endif %}
</div>
<h4 class="font-bold mb-4 text-gray-800">Ваши ответы на задачи:</h4>
<div class="space-y-4">
{% for answer in submission.answers.all %}
<div class="p-4 bg-gray-50 border rounded-lg">
<h5 class="font-medium text-sm text-gray-500 mb-2">Задача {{ forloop.counter }}: {{ answer.question.text|striptags|truncatewords:10 }}</h5>
{% if answer.question.question_type == 'TEXT_AUTO' %}
<p class="text-gray-800"><strong>Ваш ответ:</strong> {{ answer.text_answer|default:"Нет" }}</p>
<p class="text-sm mt-1 {% if answer.is_correct %}text-green-600{% elif answer.is_correct == False %}text-red-600{% else %}text-gray-500{% endif %}">
{% if answer.is_correct %}
<span class="material-icons text-[14px] align-middle">check_circle</span> Верно
{% elif answer.is_correct == False %}
<span class="material-icons text-[14px] align-middle">cancel</span> Неверно
{% else %}
<span class="material-icons text-[14px] align-middle">help_outline</span> Ожидает проверки
{% endif %}
</p>
{% else %}
{% if answer.file_answer %}
<p class="text-gray-800"><strong>Прикрепленный файл:</strong> <a href="{{ answer.file_answer.url }}" class="text-blue-600 hover:underline">Скачать</a></p>
{% else %}
<p class="text-gray-500">Файл не прикреплен</p>
{% endif %}
{% endif %}
{% if answer.points is not None %}
<p class="mt-2 text-sm text-blue-800 font-medium">Баллы: {{ answer.points }}</p>
{% endif %}
{% if answer.comment %}
<p class="mt-1 text-sm text-gray-700 bg-white p-2 rounded border"><strong>Комментарий:</strong> {{ answer.comment }}</p>
{% endif %}
</div>
{% endfor %}
</div>
{% else %}
<form method="post" enctype="multipart/form-data" class="space-y-6">
{% csrf_token %}
{% for q, field in question_fields %}
<div class="p-5 border rounded-xl bg-gray-50 border-gray-200">
<h4 class="font-semibold text-lg mb-2 text-gray-800">Задача {{ forloop.counter }}</h4>
<div class="prose max-w-none text-gray-700 mb-4">
{{ q.text|safe }}
</div>
{% if q.attached_file %}
<div class="mb-4">
<a href="{{ q.attached_file.url }}" class="inline-flex items-center px-3 py-1.5 bg-white border text-gray-700 rounded hover:bg-gray-50 transition text-sm" target="_blank">
<span class="material-icons mr-1 text-[16px]">attach_file</span> Скачать файл к задаче
</a>
</div>
{% endif %}
<div class="bg-white p-4 rounded-lg border border-gray-200">
<label for="{{ field.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-2">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<p class="mt-1 text-sm text-red-600">{{ field.errors.0 }}</p>
{% endif %}
</div>
</div>
{% endfor %}
<div class="pt-4">
<button type="submit" class="px-6 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition font-medium">
Отправить ответ
</button>
</div>
</form>
{% endif %}
</div>
{% endblock %}
+47
View File
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}ЕГЭ LMS{% endblock %}</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
body { font-family: 'Inter', sans-serif; background-color: #f8fafc; }
</style>
</head>
<body class="text-gray-800 antialiased h-screen flex flex-col">
<!-- Navbar -->
<nav class="bg-white border-b border-gray-200 shadow-sm">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<a href="/" class="flex-shrink-0 flex items-center gap-2">
<span class="material-icons text-blue-600">school</span>
<span class="font-bold text-xl tracking-tight text-gray-900">ЕГЭ LMS</span>
</a>
</div>
<div class="flex items-center gap-4">
{% if user.is_authenticated %}
<span class="text-sm text-gray-600">Привет, <b>{{ user.first_name|default:user.username }}</b></span>
<form action="{% url 'lms:logout' %}" method="post" class="inline">
{% csrf_token %}
<button type="submit" class="text-sm font-medium text-red-600 hover:text-red-800 transition">Выйти</button>
</form>
{% else %}
<a href="{% url 'lms:login' %}" class="text-sm font-medium text-blue-600 hover:text-blue-800 transition">Войти</a>
{% endif %}
</div>
</div>
</div>
</nav>
<!-- Main Content -->
<main class="flex-1 max-w-7xl w-full mx-auto px-4 sm:px-6 lg:px-8 py-8">
{% block content %}
{% endblock %}
</main>
</body>
</html>
+72
View File
@@ -0,0 +1,72 @@
{% extends 'lms/base.html' %}
{% load lms_tags %}
{% block title %}Мои задания | ЕГЭ LMS{% endblock %}
{% block content %}
<div class="mb-8 flex justify-between items-end border-b pb-4">
<div>
<h1 class="text-3xl font-bold text-gray-900">Мои задания</h1>
<p class="text-gray-500 mt-1">Список всех доступных заданий для выполнения.</p>
</div>
</div>
{% if assignments %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
{% for assignment in assignments %}
{% get_submission submissions assignment.id as sub %}
<div class="bg-white rounded-2xl shadow-sm hover:shadow-md border border-gray-100 transition-all duration-200 overflow-hidden flex flex-col">
<div class="p-6 flex-1">
<div class="flex justify-between items-start mb-4">
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
{{ assignment.subject.name }}
</span>
{% if sub %}
{% if sub.status == 'GRADED' %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800">
<span class="material-icons text-[12px] mr-1">done_all</span> Проверено ({{ sub.grade|default:"-" }})
</span>
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
<span class="material-icons text-[12px] mr-1">schedule</span> Ожидает проверки
</span>
{% endif %}
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
Не сдано
</span>
{% endif %}
</div>
<h3 class="text-xl font-semibold text-gray-900 mb-2 line-clamp-2">
{{ assignment.title }}
</h3>
<p class="text-gray-500 text-sm line-clamp-3 mb-4">
{{ assignment.description|striptags|truncatewords:20 }}
</p>
<div class="text-xs text-gray-400 mt-auto flex flex-col gap-1">
<span class="flex items-center gap-1">
<span class="material-icons text-[14px]">event</span>
Добавлено: {{ assignment.created_at|date:"d M Y" }}
</span>
</div>
</div>
<div class="bg-gray-50 p-4 border-t border-gray-100">
<a href="{% url 'lms:assignment_detail' assignment.pk %}" class="w-full inline-flex justify-center items-center px-4 py-2 border border-transparent text-sm font-medium rounded-lg text-white bg-blue-600 hover:bg-blue-700 shadow-sm transition-colors">
{% if sub %}Смотреть ответ{% else %}Выполнить задание{% endif %}
</a>
</div>
</div>
{% endfor %}
</div>
{% else %}
<div class="text-center py-20">
<span class="material-icons text-gray-300 text-6xl mb-4">assignment_turned_in</span>
<h3 class="text-xl font-medium text-gray-900 mb-1">Пока заданий нет</h3>
<p class="text-gray-500">Учитель еще не добавил новые задания.</p>
</div>
{% endif %}
{% endblock %}
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Платформа ЕГЭ LMS</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="bg-gray-50 flex items-center justify-center h-screen">
<div class="text-center p-8 bg-white shadow-lg rounded-xl max-w-md w-full">
<h1 class="text-3xl font-bold text-gray-800 mb-4">Платформа ЕГЭ</h1>
<p class="text-gray-600 mb-6">Добро пожаловать в систему для проверки домашних заданий.</p>
<a href="{% url 'lms:login' %}" class="block w-full py-3 px-4 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition">
Войти в систему
</a>
</div>
</body>
</html>
+48
View File
@@ -0,0 +1,48 @@
{% extends 'lms/base.html' %}
{% block title %}Вход | ЕГЭ LMS{% endblock %}
{% block content %}
<div class="flex items-center justify-center h-[calc(100vh-8rem)]">
<div class="bg-white p-8 rounded-2xl shadow-lg max-w-md w-full border border-gray-100">
<div class="text-center mb-8">
<span class="material-icons text-blue-600 text-5xl mb-2">lock</span>
<h2 class="text-2xl font-bold text-gray-900">Вход в систему</h2>
<p class="text-gray-500 text-sm mt-1">Пожалуйста, авторизуйтесь для доступа к заданиям</p>
</div>
<form method="post" class="space-y-6">
{% csrf_token %}
{% if form.errors %}
<div class="bg-red-50 text-red-600 p-3 rounded-lg text-sm border border-red-200">
Имя пользователя или пароль введены неверно.
</div>
{% endif %}
<div>
<label for="id_username" class="block text-sm font-medium text-gray-700 mb-1">Имя пользователя</label>
<input type="text" name="username" id="id_username" required
class="w-full px-4 py-3 rounded-xl border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition shadow-sm text-gray-800">
</div>
<div>
<label for="id_password" class="block text-sm font-medium text-gray-700 mb-1">Пароль</label>
<input type="password" name="password" id="id_password" required
class="w-full px-4 py-3 rounded-xl border border-gray-300 focus:ring-2 focus:ring-blue-500 focus:border-blue-500 outline-none transition shadow-sm text-gray-800">
</div>
<button type="submit"
class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-4 rounded-xl shadow-md hover:shadow-lg transition flex justify-center items-center gap-2">
Войти <span class="material-icons text-sm">login</span>
</button>
<input type="hidden" name="next" value="{{ next }}">
</form>
<div class="mt-6 text-center text-sm text-gray-500">
Нет аккаунта? <a href="{% url 'lms:register' %}" class="text-blue-600 hover:underline">Зарегистрироваться</a>
</div>
</div>
</div>
{% endblock %}
+49
View File
@@ -0,0 +1,49 @@
{% extends 'lms/base.html' %}
{% block title %}Регистрация | ЕГЭ LMS{% endblock %}
{% block content %}
<div class="flex items-center justify-center min-h-[calc(100vh-8rem)] py-8">
<div class="bg-white p-8 rounded-2xl shadow-lg max-w-md w-full border border-gray-100">
<div class="text-center mb-8">
<span class="material-icons text-blue-600 text-5xl mb-2">person_add</span>
<h2 class="text-2xl font-bold text-gray-900">Регистрация ученика</h2>
<p class="text-gray-500 text-sm mt-1">Создайте аккаунт для доступа к заданиям</p>
</div>
<form method="post" class="space-y-6">
{% csrf_token %}
{% if form.non_field_errors %}
<div class="bg-red-50 text-red-600 p-3 rounded-lg text-sm border border-red-200">
{{ form.non_field_errors }}
</div>
{% endif %}
{% for field in form %}
<div>
<label for="{{ field.id_for_label }}" class="block text-sm font-medium text-gray-700 mb-1">{{ field.label }}</label>
{{ field }}
{% if field.errors %}
<p class="text-red-500 text-xs mt-1">{{ field.errors.0 }}</p>
{% endif %}
{% if field.help_text %}
<p class="text-gray-400 text-xs mt-1">{{ field.help_text }}</p>
{% endif %}
</div>
{% endfor %}
<button type="submit"
class="w-full bg-blue-600 hover:bg-blue-700 text-white font-semibold py-3 px-4 rounded-xl shadow-md hover:shadow-lg transition flex justify-center items-center gap-2">
Зарегистрироваться <span class="material-icons text-sm">person_add</span>
</button>
<input type="hidden" name="next" value="{{ next }}">
</form>
<div class="mt-6 text-center text-sm text-gray-500">
Уже есть аккаунт? <a href="{% url 'lms:login' %}" class="text-blue-600 hover:underline">Войти</a>
</div>
</div>
</div>
{% endblock %}