Add allow_late_submissions toggle to assignments
This commit is contained in:
+2
-2
@@ -18,9 +18,9 @@ class QuestionInline(StackedInline):
|
|||||||
|
|
||||||
@admin.register(Assignment)
|
@admin.register(Assignment)
|
||||||
class AssignmentAdmin(ModelAdmin):
|
class AssignmentAdmin(ModelAdmin):
|
||||||
list_display = ('title', 'subject', 'is_published', 'time_limit', 'deadline', 'created_at')
|
list_display = ('title', 'subject', 'is_published', 'time_limit', 'deadline', 'allow_late_submissions', 'created_at')
|
||||||
list_display_links = ('title',)
|
list_display_links = ('title',)
|
||||||
list_filter = ('subject', 'is_published')
|
list_filter = ('subject', 'is_published', 'allow_late_submissions')
|
||||||
search_fields = ('title', 'description')
|
search_fields = ('title', 'description')
|
||||||
exclude = ('created_by',)
|
exclude = ('created_by',)
|
||||||
filter_horizontal = ('assigned_students',)
|
filter_horizontal = ('assigned_students',)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class Assignment(models.Model):
|
|||||||
created_at = models.DateTimeField('Дата создания', auto_now_add=True)
|
created_at = models.DateTimeField('Дата создания', auto_now_add=True)
|
||||||
deadline = models.DateTimeField('Дедлайн', blank=True, null=True, help_text='После этого времени ответы не принимаются.')
|
deadline = models.DateTimeField('Дедлайн', blank=True, null=True, help_text='После этого времени ответы не принимаются.')
|
||||||
time_limit = models.PositiveIntegerField('Лимит времени (минуты)', blank=True, null=True, help_text='Например, 235 для 3ч 55м. Оставьте пустым, если без таймера.')
|
time_limit = models.PositiveIntegerField('Лимит времени (минуты)', blank=True, null=True, help_text='Например, 235 для 3ч 55м. Оставьте пустым, если без таймера.')
|
||||||
|
allow_late_submissions = models.BooleanField('Разрешить дорешивание', default=True, help_text='Если включено, ученики смогут сдавать задание после дедлайна с пометкой "После дедлайна".')
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = 'Задание'
|
verbose_name = 'Задание'
|
||||||
|
|||||||
@@ -47,9 +47,16 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if assignment.deadline and now > assignment.deadline %}
|
{% if assignment.deadline and now > assignment.deadline %}
|
||||||
<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">
|
{% 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>
|
Дедлайн прошел
|
||||||
|
</span>
|
||||||
|
{% 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="w-1.5 h-1.5 rounded-full bg-rose-400"></span>
|
||||||
|
Прием закрыт
|
||||||
|
</span>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-status-roseBg text-status-rose border border-status-rose/30">
|
<span class="inline-flex items-center gap-1.5 px-2 py-0.5 rounded text-xs font-mono font-medium bg-status-roseBg text-status-rose border border-status-rose/30">
|
||||||
<span class="w-1.5 h-1.5 rounded-full bg-status-rose"></span>
|
<span class="w-1.5 h-1.5 rounded-full bg-status-rose"></span>
|
||||||
|
|||||||
+2
-1
@@ -72,7 +72,8 @@ def assignment_detail(request, pk):
|
|||||||
|
|
||||||
if assignment.deadline and now > assignment.deadline:
|
if assignment.deadline and now > assignment.deadline:
|
||||||
is_late = True
|
is_late = True
|
||||||
# can_submit = False # Allow late submissions
|
if not assignment.allow_late_submissions:
|
||||||
|
can_submit = False
|
||||||
|
|
||||||
if assignment.time_limit:
|
if assignment.time_limit:
|
||||||
if not submission:
|
if not submission:
|
||||||
|
|||||||
Reference in New Issue
Block a user