+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
+
+