diff --git a/judge/models/problem.py b/judge/models/problem.py
index c2ebf7eb4f..cec1168b9f 100644
--- a/judge/models/problem.py
+++ b/judge/models/problem.py
@@ -76,8 +76,7 @@ def __init__(self, **kwargs):
def add_i18n_name(self, language):
queryset = self._clone()
alias = unique_together_left_join(queryset, ProblemTranslation, 'problem', 'language', language)
- return queryset.annotate(i18n_name=Coalesce(RawSQL('%s.name' % alias, ()), F('name'),
- output_field=models.CharField()))
+ return queryset.annotate(i18n_name=RawSQL('%s.name' % alias, ()))
class TranslatedProblemForeignKeyQuerySet(QuerySet):
diff --git a/templates/contest/contest.html b/templates/contest/contest.html
index 0207a37591..4b21079de8 100644
--- a/templates/contest/contest.html
+++ b/templates/contest/contest.html
@@ -94,9 +94,9 @@
{{ _
{% if problem.is_public %}
- {{ problem.i18n_name }}
+ {{ problem.i18n_name or problem.name }}
{% else %}
- {{ problem.i18n_name }}
+ {{ problem.i18n_name or problem.name }}
{% endif %}
|
{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %} |
diff --git a/templates/problem/list.html b/templates/problem/list.html
index af29e99b2e..ed2f513a6d 100644
--- a/templates/problem/list.html
+++ b/templates/problem/list.html
@@ -275,7 +275,7 @@ {{ _('Hot problems') }}
{% endif %}
{% endif %}
- {{ problem.i18n_name }}
+ {{ problem.i18n_name or problem.name }}
|
{{ problem.group.full_name }} |
{% if show_types %}
diff --git a/templates/submission/list.html b/templates/submission/list.html
index c1f52a0cea..a2acf5a3e8 100644
--- a/templates/submission/list.html
+++ b/templates/submission/list.html
@@ -359,7 +359,7 @@ {{ _('Statistics') }}
{% set profile_id = request.profile.id if request.user.is_authenticated else 0 %}
{% for submission in submissions %}
- {% with problem_name=show_problem and submission.problem.i18n_name %}
+ {% with problem_name=show_problem and (submission.problem.i18n_name or submission.problem.name) %}
{% include "submission/row.html" %}
{% endwith %}