views.py 618 Bytes
Newer Older
Florent Chehab's avatar
Florent Chehab committed
1
2
from django.shortcuts import render

3
4
5
from backend_app.utils import clean_route
from backend_app.viewsets import ALL_VIEWSETS

Florent Chehab's avatar
Florent Chehab committed
6
7
8
9
10
11
12

def index(request):
    """
    View to to display the index app that contains the JS / CSS
    The "template" displayed is in ./templates/index.html
    """

13
14
    # We give the user object so that we can access its id in JS
    # and fetch userData
15
16
17
18
19
    user = request.user

    # We also retrieve the list of all routes endpoints
    endpoints = list(map(lambda v: clean_route(v.end_point_route), ALL_VIEWSETS))
    return render(request, "index.html", dict(user=user, endpoints=endpoints))