feat: add support for TABLE_AUTO question type with table input rendering and auto-grading

This commit is contained in:
Dmitry Belan
2026-09-19 12:19:02 +03:00
parent 9ee1788692
commit 46319def76
9 changed files with 157 additions and 19 deletions
+10
View File
@@ -14,6 +14,16 @@ class AnswersForm(forms.Form):
'placeholder': 'Введите ваш ответ здесь...'
})
)
elif q.question_type == 'TABLE_AUTO':
rows = getattr(q, 'table_rows', 2) or 2
for i in range(1, rows + 1):
for j in range(1, 3):
self.fields[f'answer_{q.id}_r{i}_c{j}'] = forms.CharField(
required=False,
widget=forms.TextInput(attrs={
'class': 'w-full px-2 py-1 border rounded focus:outline-none focus:ring-1 focus:ring-blue-500',
})
)
else:
self.fields[f'file_{q.id}'] = forms.FileField(
label='Прикрепить файл:',