Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL Sosial
pilar
pilar-backend
Commits
09dbe011
Commit
09dbe011
authored
Nov 24, 2020
by
rayhan muzakki
Browse files
merged with coldfix-pbi9 and delete auto batch
parent
3e93db48
Changes
5
Hide whitespace changes
Inline
Side-by-side
api/migrations/0003_auto_2020112
2
_1
402
.py
→
api/migrations/0003_auto_2020112
4
_1
931
.py
View file @
09dbe011
# Generated by Django 3.0.7 on 2020-11-2
2 07:02
# Generated by Django 3.0.7 on 2020-11-2
4 12:31
from
decimal
import
Decimal
import
django.core.validators
...
...
@@ -27,19 +27,4 @@ class Migration(migrations.Migration):
name
=
'total_profit'
,
field
=
models
.
DecimalField
(
blank
=
True
,
decimal_places
=
2
,
default
=
Decimal
(
'0'
),
max_digits
=
12
,
null
=
True
,
validators
=
[
django
.
core
.
validators
.
MinValueValidator
(
Decimal
(
'0.01'
))],
verbose_name
=
'total profit'
),
),
migrations
.
AddField
(
model_name
=
'user'
,
name
=
'number_of_cash_donations'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
,
verbose_name
=
'number of cash donations'
),
),
migrations
.
AddField
(
model_name
=
'user'
,
name
=
'number_of_goods_donations'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
,
verbose_name
=
'number of goods donations'
),
),
migrations
.
AddField
(
model_name
=
'user'
,
name
=
'number_of_transactions'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
,
verbose_name
=
'number of transactions'
),
),
]
api/migrations/0004_auto_20201124_1832.py
deleted
100644 → 0
View file @
3e93db48
# Generated by Django 3.0.7 on 2020-11-24 11:32
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'api'
,
'0003_auto_20201122_1402'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'user'
,
name
=
'number_of_cash_donations'
,
),
migrations
.
RemoveField
(
model_name
=
'user'
,
name
=
'number_of_goods_donations'
,
),
migrations
.
RemoveField
(
model_name
=
'user'
,
name
=
'number_of_transactions'
,
),
]
api/tests.py
View file @
09dbe011
...
...
@@ -757,29 +757,6 @@ class UserTest(rest_framework_test.APITestCase):
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_user_transactionsort_list_success
(
self
):
response
=
request
(
'GET'
,
'user-list-sorttransaction'
,
http_authorization
=
self
.
superuser_http_authorization
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_user_cashsort_list_success
(
self
):
response
=
request
(
'GET'
,
'user-list-sortcash'
,
http_authorization
=
self
.
superuser_http_authorization
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_user_goodssort_list_success
(
self
):
response
=
request
(
'GET'
,
'user-list-sortgoods'
,
http_authorization
=
self
.
superuser_http_authorization
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
def
test_user_detail_success
(
self
):
response
=
request
(
...
...
api/urls.py
View file @
09dbe011
...
...
@@ -52,9 +52,6 @@ urlpatterns = [
),
urls
.
path
(
'users/'
,
api_views
.
UserList
.
as_view
(),
name
=
'user-list'
),
urls
.
path
(
'users/sorttransaction'
,
api_views
.
UserListTransaction
.
as_view
(),
name
=
'user-list-sorttransaction'
),
urls
.
path
(
'users/sortcash'
,
api_views
.
UserListCash
.
as_view
(),
name
=
'user-list-sortcash'
),
urls
.
path
(
'users/sortgoods'
,
api_views
.
UserListGoods
.
as_view
(),
name
=
'user-list-sortgoods'
),
urls
.
path
(
'users/<str:pk>/'
,
api_views
.
UserDetail
.
as_view
(),
name
=
'user-detail'
),
urls
.
path
(
'bank-account-transfer-destinations/'
,
...
...
api/views.py
View file @
09dbe011
...
...
@@ -488,7 +488,7 @@ class UserList(generics.ListCreateAPIView):
filterset_fields
=
[
'username'
,
'phone_number'
]
ordering_fields
=
[
'username'
,
'full_name'
,
'phone_number'
,
'
number_of
_transactions'
,
'
number_of_cash_donations'
,
'number_of_goods
_donations'
'
total
_transactions'
,
'
total_program_donations_goods'
,
'total_program
_donations
_cash
'
]
pagination_class
=
paginations
.
SmallResultsSetPagination
permission_classes
=
[
rest_framework_permissions
.
IsAdminUser
]
...
...
@@ -496,57 +496,6 @@ class UserList(generics.ListCreateAPIView):
search_fields
=
[
'username'
,
'full_name'
,
'phone_number'
]
serializer_class
=
api_serializers
.
UserSerializer
class
UserListTransaction
(
generics
.
ListCreateAPIView
):
filter_backends
=
[
rest_framework
.
DjangoFilterBackend
,
rest_framework_filters
.
OrderingFilter
,
rest_framework_filters
.
SearchFilter
,
]
filterset_fields
=
[
'username'
,
'phone_number'
]
ordering_fields
=
[
'username'
,
'full_name'
,
'phone_number'
,
'number_of_transactions'
,
'number_of_cash_donations'
,
'number_of_goods_donations'
]
pagination_class
=
paginations
.
SmallResultsSetPagination
permission_classes
=
[
rest_framework_permissions
.
IsAdminUser
]
queryset
=
models
.
User
.
objects
.
all
().
order_by
(
'-number_of_transactions'
)
search_fields
=
[
'username'
,
'full_name'
,
'phone_number'
]
serializer_class
=
api_serializers
.
UserSerializer
class
UserListCash
(
generics
.
ListCreateAPIView
):
filter_backends
=
[
rest_framework
.
DjangoFilterBackend
,
rest_framework_filters
.
OrderingFilter
,
rest_framework_filters
.
SearchFilter
,
]
filterset_fields
=
[
'username'
,
'phone_number'
]
ordering_fields
=
[
'username'
,
'full_name'
,
'phone_number'
,
'number_of_transactions'
,
'number_of_cash_donations'
,
'number_of_goods_donations'
]
pagination_class
=
paginations
.
SmallResultsSetPagination
permission_classes
=
[
rest_framework_permissions
.
IsAdminUser
]
queryset
=
models
.
User
.
objects
.
all
().
order_by
(
'-number_of_cash_donations'
)
search_fields
=
[
'username'
,
'full_name'
,
'phone_number'
]
serializer_class
=
api_serializers
.
UserSerializer
class
UserListGoods
(
generics
.
ListCreateAPIView
):
filter_backends
=
[
rest_framework
.
DjangoFilterBackend
,
rest_framework_filters
.
OrderingFilter
,
rest_framework_filters
.
SearchFilter
,
]
filterset_fields
=
[
'username'
,
'phone_number'
]
ordering_fields
=
[
'username'
,
'full_name'
,
'phone_number'
,
'number_of_transactions'
,
'number_of_cash_donations'
,
'number_of_goods_donations'
]
pagination_class
=
paginations
.
SmallResultsSetPagination
permission_classes
=
[
rest_framework_permissions
.
IsAdminUser
]
queryset
=
models
.
User
.
objects
.
all
().
order_by
(
'-number_of_goods_donations'
)
search_fields
=
[
'username'
,
'full_name'
,
'phone_number'
]
serializer_class
=
api_serializers
.
UserSerializer
class
UserDetail
(
generics
.
RetrieveUpdateDestroyAPIView
):
permission_classes
=
[
api_permissions
.
IsAdminUserOrSelf
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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