Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ryan Karyadiputera
ppl-berkah-back
Commits
216a8c96
Commit
216a8c96
authored
Jun 06, 2021
by
Ryan Karyadiputera
Browse files
test3
parent
c56253c6
Pipeline
#81601
passed with stage
in 2 minutes and 27 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
lembaga/views.py
View file @
216a8c96
...
...
@@ -11,14 +11,14 @@ from django_filters.rest_framework import DjangoFilterBackend
@
api_view
([
"GET"
])
# pragma: no cover
@
permission_classes
([
AllowAny
])
def
get_lembaga
(
request
,
time
):
#
current_year = 2021
#
if (time == "newer"):
#
supervisor_lembaga = Lembaga.objects.filter(last_
activity = 0
)
#
#
supervisor_lembaga2 = Lembaga.objects.filter(last_
activity
= None)
#
#
supervisor_lembaga = supervisor_lembaga1 | supervisor_lembaga2
#
elif (time == "older"):
supervisor_lembaga
=
Lembaga
.
objects
.
filter
(
last_insertion
=
None
)
current_year
=
2021
if
(
time
==
"newer"
):
supervisor_lembaga
1
=
Lembaga
.
objects
.
filter
(
last_
insertion__range
=
(
current_year
-
5
,
current_year
)
)
supervisor_lembaga2
=
Lembaga
.
objects
.
filter
(
last_
insertion
=
None
)
supervisor_lembaga
=
supervisor_lembaga1
|
supervisor_lembaga2
elif
(
time
==
"older"
):
supervisor_lembaga
=
Lembaga
.
objects
.
filter
(
last_insertion
__range
=
(
0
,
current_year
-
6
)
)
serializer
=
LembagaSerializer
(
supervisor_lembaga
,
context
=
{
'request'
:
request
},
many
=
True
)
response
=
serializer
.
data
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment