mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2024-12-05 02:06:52 +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
|
||||
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 Meta:
|
||||
|
@ -23,7 +23,9 @@
|
||||
<dt class="col-sm-2">{% trans "Video link:" %}</dt>
|
||||
<dd class="col-sm-10"><a href="{{ participation.solution.link|default:"#" }}" target="_blank">
|
||||
{{ 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>
|
||||
</dl>
|
||||
{% if participation.solution.platform == "youtube" %}
|
||||
|
@ -262,6 +262,14 @@ class ParticipationDetailView(LoginRequiredMixin, DetailView):
|
||||
return super().dispatch(request, *args, **kwargs)
|
||||
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):
|
||||
model = Video
|
||||
|
Loading…
Reference in New Issue
Block a user