Fakultas Ilmu Komputer UI

Commit 8cefbd2d authored by Ryan Karyadiputera's avatar Ryan Karyadiputera
Browse files

test3

parent aa4074a0
Pipeline #81570 passed with stage
in 2 minutes and 22 seconds
...@@ -11,14 +11,14 @@ from django_filters.rest_framework import DjangoFilterBackend ...@@ -11,14 +11,14 @@ from django_filters.rest_framework import DjangoFilterBackend
@api_view(["GET"]) # pragma: no cover @api_view(["GET"]) # pragma: no cover
@permission_classes([AllowAny]) @permission_classes([AllowAny])
def get_lembaga(request, time): def get_lembaga(request, time):
current_year = 2021 # current_year = 2021
if (time == "newer"): if (time == "newer"):
supervisor_lembaga = Lembaga.objects.filter(last_activity__range = (current_year - 5, current_year)) supervisor_lembaga = Lembaga.objects.filter(last_activity__range = (0, 10))
# supervisor_lembaga2 = Lembaga.objects.filter(last_activity = None) # supervisor_lembaga2 = Lembaga.objects.filter(last_activity = None)
# supervisor_lembaga = supervisor_lembaga1 | supervisor_lembaga2 # supervisor_lembaga = supervisor_lembaga1 | supervisor_lembaga2
elif (time == "older"): elif (time == "older"):
supervisor_lembaga = Lembaga.objects.filter(last_activity__range = (0, current_year - 6)) supervisor_lembaga = Lembaga.objects.filter(last_activity__range = (0, 20))
serializer = LembagaSerializer(supervisor_lembaga, context={'request': request}, many=True) serializer = LembagaSerializer(supervisor_lembaga, context={'request': request}, many=True)
response = serializer.data response = serializer.data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment