Skip to content

Views

hypha.api.v2.views

open_calls_json

open_calls_json(request)

Open calls in JSON format.

List open calls in JSON format, useful when you want to list open calls on an external site.

Source code in hypha/api/v2/views.py
@ratelimit(key="ip", rate=settings.DEFAULT_RATE_LIMIT)
def open_calls_json(request):
    """Open calls in JSON format.

    List open calls in JSON format, useful when you want to list open calls on an external site.
    """
    rounds = ApplicationBase.objects.order_by_end_date().specific()
    labs = LabBase.objects.public().live().specific()
    all_funds = list(rounds) + list(labs)

    # Only pass rounds/labs that are open & visible for the front page
    data = [
        fund.as_json
        for fund in all_funds
        if fund.open_round and fund.list_on_front_page
    ]
    return JsonResponse(data, safe=False)