+def cache_until_start(view_func):
+ @wraps(view_func)
+ def _wrapped_view_func(request, *args, **kwargs):
+ response = view_func(request, *args, **kwargs)
+ max_age = max(int((CompetitionState.start - timezone.now()).total_seconds()) + 1, 0)
+ if max_age:
+ patch_cache_control(response, max_age=max_age)
+ else:
+ add_never_cache_headers(response)
+ return response
+
+ return _wrapped_view_func
+
+
+def get_submission(submission_id):
+ try:
+ submission_id = int(submission_id)
+ except ValueError:
+ raise Http404
+ return get_object_or_404(Submission, id=submission_id)
+
+