diff --git a/apps/participation/forms.py b/apps/participation/forms.py index 7217f7c..f49856c 100644 --- a/apps/participation/forms.py +++ b/apps/participation/forms.py @@ -4,7 +4,7 @@ from django import forms from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ -from .models import Team +from .models import Team, Participation class TeamForm(forms.ModelForm): @@ -36,3 +36,9 @@ class JoinTeamForm(forms.ModelForm): class Meta: model = Team fields = ('access_code',) + + +class ParticipationForm(forms.ModelForm): + class Meta: + model = Participation + fields = ('problem',) diff --git a/apps/participation/models.py b/apps/participation/models.py index 70c07f6..8f3ac3b 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -2,6 +2,8 @@ from django.core.validators import RegexValidator from django.db import models from django.db.models import Index from django.utils.crypto import get_random_string +from django.utils.functional import lazy +from django.utils.text import format_lazy from django.utils.translation import gettext_lazy as _ @@ -56,7 +58,7 @@ class Participation(models.Model): ) problem = models.IntegerField( - choices=[(i, _("Problem #{problem:d}").format(problem=i)) for i in range(1, 5)], + choices=[(i, format_lazy(_("Problem #{problem:d}"), problem=i)) for i in range(1, 5)], null=True, default=None, verbose_name=_("problem number"), diff --git a/apps/participation/templates/participation/create_team.html b/apps/participation/templates/participation/create_team.html index 1be29f5..1c93537 100644 --- a/apps/participation/templates/participation/create_team.html +++ b/apps/participation/templates/participation/create_team.html @@ -10,4 +10,4 @@ -{% endblock content %} \ No newline at end of file +{% endblock content %} diff --git a/apps/participation/templates/participation/create_team_modal.html b/apps/participation/templates/participation/create_team_modal.html index 242c645..6163660 100644 --- a/apps/participation/templates/participation/create_team_modal.html +++ b/apps/participation/templates/participation/create_team_modal.html @@ -1,4 +1,4 @@ -{% load crispy_forms_filters i18n %} +{% load i18n %}