__find_api_end_point_for_viewset.py 324 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
from shared import get_api_objs
2 3


Florent Chehab's avatar
Florent Chehab committed
4 5 6 7
def find_api_end_point_for_viewset(viewset_name: str) -> str:
    """
    Gets the api endpoint associated with a viewset
    """
8

Florent Chehab's avatar
Florent Chehab committed
9 10 11
    for obj in get_api_objs(has_model=None, make_imports=False):
        if obj.viewset == viewset_name:
            return obj.api_end_point
12 13

    return None