Add help text and trans

This commit is contained in:
cuom1999 2022-06-02 00:20:45 -05:00
parent a1bcc2cb46
commit 8ba39a1f97
6 changed files with 85 additions and 22 deletions

View file

@ -6,18 +6,22 @@ from django.db import migrations, models
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('judge', '0123_auto_20220502_2356'), ("judge", "0123_auto_20220502_2356"),
] ]
operations = [ operations = [
migrations.AddField( migrations.AddField(
model_name='problemdata', model_name="problemdata",
name='fileio_input', name="fileio_input",
field=models.TextField(blank=True, null=True, verbose_name='input file name'), field=models.TextField(
blank=True, null=True, verbose_name="input file name"
),
), ),
migrations.AddField( migrations.AddField(
model_name='problemdata', model_name="problemdata",
name='fileio_output', name="fileio_output",
field=models.TextField(blank=True, null=True, verbose_name='output file name'), field=models.TextField(
blank=True, null=True, verbose_name="output file name"
),
), ),
] ]

View file

@ -0,0 +1,33 @@
# Generated by Django 2.2.25 on 2022-06-02 05:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("judge", "0124_auto_20220602_1116"),
]
operations = [
migrations.AlterField(
model_name="problemdata",
name="fileio_input",
field=models.TextField(
blank=True,
help_text="Leave empty for stdin",
null=True,
verbose_name="input file name",
),
),
migrations.AlterField(
model_name="problemdata",
name="fileio_output",
field=models.TextField(
blank=True,
help_text="Leave empty for stdout",
null=True,
verbose_name="output file name",
),
),
]

View file

@ -106,10 +106,16 @@ class ProblemData(models.Model):
validators=[FileExtensionValidator(allowed_extensions=["cpp"])], validators=[FileExtensionValidator(allowed_extensions=["cpp"])],
) )
fileio_input = models.TextField( fileio_input = models.TextField(
verbose_name=_("input file name"), blank=True, null=True verbose_name=_("input file name"),
blank=True,
null=True,
help_text=_("Leave empty for stdin"),
) )
fileio_output = models.TextField( fileio_output = models.TextField(
verbose_name=_("output file name"), blank=True, null=True verbose_name=_("output file name"),
blank=True,
null=True,
help_text=_("Leave empty for stdout"),
) )
__original_zipfile = None __original_zipfile = None

View file

@ -542,8 +542,10 @@ class ProblemSubmissionsBase(SubmissionsListBase):
if self.check_contest_in_access_check: if self.check_contest_in_access_check:
self.access_check_contest(request) self.access_check_contest(request)
else: else:
is_own = hasattr(self, 'is_own') and self.is_own is_own = hasattr(self, "is_own") and self.is_own
if not is_own and not self.problem.is_accessible_by(request.user, request.in_contest_mode): if not is_own and not self.problem.is_accessible_by(
request.user, request.in_contest_mode
):
raise Http404() raise Http404()
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
@ -805,7 +807,9 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
context["contest"] = self.contest context["contest"] = self.contest
context["problem"] = self.problem context["problem"] = self.problem
context["profile"] = self.profile context["profile"] = self.profile
context["profile_id"] = self.request.profile.id if self.request.profile else None context["profile_id"] = (
self.request.profile.id if self.request.profile else None
)
contest_problem = self.contest.contest_problems.get(problem=self.problem) contest_problem = self.contest.contest_problems.get(problem=self.problem)
for s in context["submissions"]: for s in context["submissions"]:
@ -823,4 +827,4 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
try: try:
return super(UserContestSubmissionsAjax, self).get(request, *args, **kwargs) return super(UserContestSubmissionsAjax, self).get(request, *args, **kwargs)
except Http404: except Http404:
return HttpResponse(_("You don't have permission to access.")) return HttpResponse(_("You don't have permission to access."))

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: lqdoj2\n" "Project-Id-Version: lqdoj2\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-06-02 11:58+0700\n" "POT-Creation-Date: 2022-06-02 12:17+0700\n"
"PO-Revision-Date: 2021-07-20 03:44\n" "PO-Revision-Date: 2021-07-20 03:44\n"
"Last-Translator: Icyene\n" "Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n" "Language-Team: Vietnamese\n"
@ -1676,10 +1676,18 @@ msgstr ""
msgid "input file name" msgid "input file name"
msgstr "tên file input" msgstr "tên file input"
#: judge/models/problem_data.py:109
msgid "Leave empty for stdin"
msgstr "Để trống nếu nhập từ bàn phím"
#: judge/models/problem_data.py:112 judge/models/problem_data.py:190 #: judge/models/problem_data.py:112 judge/models/problem_data.py:190
msgid "output file name" msgid "output file name"
msgstr "tên file output" msgstr "tên file output"
#: judge/models/problem_data.py:112
msgid "Leave empty for stdout"
msgstr "Để trống nếu xuất ra màn hình"
#: judge/models/problem_data.py:171 #: judge/models/problem_data.py:171
msgid "problem data set" msgid "problem data set"
msgstr "tập hợp dữ liệu bài" msgstr "tập hợp dữ liệu bài"
@ -4387,6 +4395,19 @@ msgstr "Hướng dẫn"
msgid "View YAML" msgid "View YAML"
msgstr "Xem YAML" msgstr "Xem YAML"
#: templates/problem/data.html:454
msgid "Autofill testcases"
msgstr "Tự động điền test"
#: templates/problem/data.html:457 templates/problem/problem.html:302
msgid "Problem type"
msgid_plural "Problem types"
msgstr[0] "Dạng bài"
#: templates/problem/data.html:464
msgid "Fill testcases"
msgstr "Điền test"
#: templates/problem/data.html:468 templates/problem/data.html:519 #: templates/problem/data.html:468 templates/problem/data.html:519
msgid "Apply!" msgid "Apply!"
msgstr "Lưu!" msgstr "Lưu!"
@ -4670,11 +4691,6 @@ msgid "Author:"
msgid_plural "Authors:" msgid_plural "Authors:"
msgstr[0] "Tác giả:" msgstr[0] "Tác giả:"
#: templates/problem/problem.html:302
msgid "Problem type"
msgid_plural "Problem types"
msgstr[0] "Dạng bài"
#: templates/problem/problem.html:315 #: templates/problem/problem.html:315
msgid "Allowed languages" msgid "Allowed languages"
msgstr "Ngôn ngữ cho phép" msgstr "Ngôn ngữ cho phép"

View file

@ -451,17 +451,17 @@
<table class="table"> <table class="table">
{{ data_form.as_table() }} {{ data_form.as_table() }}
<th> <th>
<label>Autofill testcases:</label> <label>{{_('Autofill testcases')}}:</label>
</th> </th>
<td> <td>
Problem type: {{_('Problem type')}}:
<select id="problem-type"> <select id="problem-type">
<option value="ICPC">ICPC</option> <option value="ICPC">ICPC</option>
<option value="OI">OI</option> <option value="OI">OI</option>
</select> </select>
<a id="fill-testcases" href="#"> <a id="fill-testcases" href="#">
<i class="fa fa-circle"></i> <i class="fa fa-circle"></i>
Fill testcases {{_('Fill testcases')}}
</a> </a>
</td> </td>
</table> </table>