app/grandchallenge/subdomains/middleware.py
def middleware(request):
        """
        Adds the challenge to the request based on the subdomain,
        raising Http404 if challenge is not valid. Requires the
        subdomain to be set on the request (eg, by using subdomain_middleware)
        """
        subdomain = request.subdomain

        if subdomain in [*settings.WORKSTATIONS_RENDERING_SUBDOMAINS, None]:
            request.challenge = None
        else:
            request.challenge = get_object_or_404(
                Challenge.objects.select_related("forum").prefetch_related(
                    "phase_set"
                ),
                short_name__iexact=subdomain,
            )

        response = get_response(request)

        return response

        Adds the challenge to the request based on the subdomain,
        raising Http404 if challenge is not valid. Requires the
        subdomain to be set on the request (eg, by using subdomain_middleware)
        
Adds the challenge to the request based on the subdomain,
raising Http404 if challenge is not valid. Requires the
subdomain to be set on the request
Adds the challenge to the request based on the subdomain raising Http404 if challenge is not valid . Requires the subdomain to be set on the request
def middleware(request):
        subdomain = request.subdomain
        if subdomain in [*settings.WORKSTATIONS_RENDERING_SUBDOMAINS, None]:
            request.challenge = None
        else:
            request.challenge = get_object_or_404(
                Challenge.objects.select_related("forum").prefetch_related(
                    "phase_set"
                ),
                short_name__iexact=subdomain,
            )
        response = get_response(request)
        return response
def middleware ( request ) : subdomain = request . subdomain if subdomain in [ * settings . WORKSTATIONS_RENDERING_SUBDOMAINS , None ] : request . challenge = None else : request . challenge = get_object_or_404 ( Challenge . objects . select_related ( "forum" ) . prefetch_related ( "phase_set" ) , short_name__iexact = subdomain , ) response = get_response ( request ) return response
Adds the challenge to the request based on the subdomain,
raising Http404 if challenge is not valid.
Adds the challenge to the request based on the subdomain raising Http404 if challenge is not valid .
"""
        Adds the challenge to the request based on the subdomain,
        raising Http404 if challenge is not valid. Requires the
        subdomain to be set on the request (eg, by using subdomain_middleware)
        """
request