mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-02-06 08:53:00 +00:00
Don't upload videos after the deadline
This commit is contained in:
parent
ab315a69ed
commit
9159e7323d
@ -74,6 +74,11 @@ class UploadVideoForm(forms.ModelForm):
|
|||||||
model = Video
|
model = Video
|
||||||
fields = ('link',)
|
fields = ('link',)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if Phase.current_phase().phase_number != 1 and self.instance.link:
|
||||||
|
self.add_error("link", _("You can't upload your video after the deadline."))
|
||||||
|
return super().clean()
|
||||||
|
|
||||||
|
|
||||||
class PhaseForm(forms.ModelForm):
|
class PhaseForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -23,7 +23,9 @@
|
|||||||
<dt class="col-sm-2">{% trans "Video link:" %}</dt>
|
<dt class="col-sm-2">{% trans "Video link:" %}</dt>
|
||||||
<dd class="col-sm-10"><a href="{{ participation.solution.link|default:"#" }}" target="_blank">
|
<dd class="col-sm-10"><a href="{{ participation.solution.link|default:"#" }}" target="_blank">
|
||||||
{{ participation.solution.link|default:novideo }}</a>
|
{{ participation.solution.link|default:novideo }}</a>
|
||||||
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadVideoModal">{% trans "Upload" %}</button>
|
{% if current_phase.phase_number == 1 or participation.solution.link == "" %}
|
||||||
|
<button class="btn btn-primary" data-toggle="modal" data-target="#uploadVideoModal">{% trans "Upload" %}</button>
|
||||||
|
{% endif %}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
{% if participation.solution.platform == "youtube" %}
|
{% if participation.solution.platform == "youtube" %}
|
||||||
|
@ -262,6 +262,14 @@ class ParticipationDetailView(LoginRequiredMixin, DetailView):
|
|||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
raise PermissionDenied
|
raise PermissionDenied
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
context["title"] = lambda: _("Participation of team {trigram}").format(trigram=self.object.team.trigram)
|
||||||
|
context["current_phase"] = Phase.current_phase()
|
||||||
|
|
||||||
|
return context
|
||||||
|
|
||||||
|
|
||||||
class UploadVideoView(LoginRequiredMixin, UpdateView):
|
class UploadVideoView(LoginRequiredMixin, UpdateView):
|
||||||
model = Video
|
model = Video
|
||||||
|
Loading…
x
Reference in New Issue
Block a user