Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
R
red-ci-cd
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
red-group-test
red-ci-cd
Commits
2e6acaa7
Commit
2e6acaa7
authored
Nov 13, 2019
by
Gladys Forte
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
search ordering extract
parent
d3a0e6c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
app/applicationlayer/management/batchupload/views.py
app/applicationlayer/management/batchupload/views.py
+5
-4
app/applicationlayer/utils.py
app/applicationlayer/utils.py
+18
-0
No files found.
app/applicationlayer/management/batchupload/views.py
View file @
2e6acaa7
...
...
@@ -20,7 +20,7 @@ from app.entities.models import (
)
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
,
main_threading
main_threading
,
CustomPaginationUserHistory
)
from
rest_framework.exceptions
import
ParseError
from
django.db.models
import
Q
...
...
@@ -35,7 +35,7 @@ from app.applicationlayer.management.batchupload.table_filters import ExtractTra
class
BatchUploadViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
ExtractTransformLoad
.
objects
.
all
()
serializer_class
=
ExtractTransformLoadSerializer
pagination_class
=
CustomPagination
pagination_class
=
CustomPagination
UserHistory
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
ExtractTransformLoadFilter
...
...
@@ -45,10 +45,11 @@ class BatchUploadViewSet(viewsets.ModelViewSet):
search_fields
=
(
'file_name'
,
'model_type'
,
'code'
)
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
logged_user
=
request
.
user
.
username
queryset
=
self
.
get_queryset
()
.
filter
(
createdby
=
logged_user
)
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
()
.
filter
(
createdby
=
logged_user
))
# queryset = self.get_queryset().filter(createdby=logged_user)
page
=
self
.
paginate_queryset
(
queryset
)
...
...
app/applicationlayer/utils.py
View file @
2e6acaa7
...
...
@@ -53,6 +53,24 @@ class CustomPagination(PageNumberPagination):
'results'
:
data
[
'results'
]
})
class
CustomPaginationUserHistory
(
PageNumberPagination
):
page_size
=
100
max_page_size
=
100
page_query_param
=
'page'
page_size_query_param
=
'page_size'
def
get_paginated_response
(
self
,
data
):
return
Response
({
'page_number'
:
self
.
page
.
number
,
'size_per_page'
:
self
.
page
.
paginator
.
per_page
,
'total_pages'
:
self
.
page
.
paginator
.
num_pages
,
'total'
:
self
.
page
.
paginator
.
count
,
'code'
:
data
[
'code'
],
'status'
:
data
[
'status'
],
'message'
:
data
[
'message'
],
'results'
:
data
[
'results'
]
})
# def entitylogs_decorator(function):
# @wraps(function)
...
...
Write
Preview
Markdown
is supported
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