-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
866fb07
commit 1578003
Showing
3 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from django.urls import path | ||
from kernelCI_app import views | ||
|
||
|
||
urlpatterns = [ | ||
path('tree/', views.TreeView.as_view(), name='tree') | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
# from django.shortcuts import render | ||
from django.http import JsonResponse | ||
from django.views import View | ||
|
||
# Create your views here. | ||
from kernelCI_app.models import Checkouts | ||
from kernelCI_app.serializers import TreeSerializer | ||
from kernelCI_app.utils import get_visible_record_ids | ||
|
||
|
||
class TreeView(View): | ||
|
||
def get(self, _): | ||
checkout_ids = get_visible_record_ids('checkouts') | ||
checkouts = Checkouts.objects.filter(id__in=checkout_ids) | ||
serializer = TreeSerializer(checkouts, many=True) | ||
|
||
return JsonResponse(serializer.data, safe=False) |