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):
dependencies = [
('judge', '0123_auto_20220502_2356'),
("judge", "0123_auto_20220502_2356"),
]
operations = [
migrations.AddField(
model_name='problemdata',
name='fileio_input',
field=models.TextField(blank=True, null=True, verbose_name='input file name'),
model_name="problemdata",
name="fileio_input",
field=models.TextField(
blank=True, null=True, verbose_name="input file name"
),
),
migrations.AddField(
model_name='problemdata',
name='fileio_output',
field=models.TextField(blank=True, null=True, verbose_name='output file name'),
model_name="problemdata",
name="fileio_output",
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"])],
)
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(
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

View file

@ -542,8 +542,10 @@ class ProblemSubmissionsBase(SubmissionsListBase):
if self.check_contest_in_access_check:
self.access_check_contest(request)
else:
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):
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
):
raise Http404()
def get(self, request, *args, **kwargs):
@ -805,7 +807,9 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
context["contest"] = self.contest
context["problem"] = self.problem
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)
for s in context["submissions"]:
@ -823,4 +827,4 @@ class UserContestSubmissionsAjax(UserContestSubmissions):
try:
return super(UserContestSubmissionsAjax, self).get(request, *args, **kwargs)
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 ""
"Project-Id-Version: lqdoj2\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"
"Last-Translator: Icyene\n"
"Language-Team: Vietnamese\n"
@ -1676,10 +1676,18 @@ msgstr ""
msgid "input file name"
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
msgid "output file name"
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
msgid "problem data set"
msgstr "tập hợp dữ liệu bài"
@ -4387,6 +4395,19 @@ msgstr "Hướng dẫn"
msgid "View 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
msgid "Apply!"
msgstr "Lưu!"
@ -4670,11 +4691,6 @@ msgid "Author:"
msgid_plural "Authors:"
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
msgid "Allowed languages"
msgstr "Ngôn ngữ cho phép"

View file

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