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
4b57d7c4
Commit
4b57d7c4
authored
Feb 24, 2020
by
Gladys Forte
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'core-dev' into 'core-sit'
Core dev See merge request rms/Backend/api-main-service!877
parents
d3b1fb87
bbadb97b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
1 addition
and
121 deletions
+1
-121
app/applicationlayer/download/accounts/views.py
app/applicationlayer/download/accounts/views.py
+1
-9
app/applicationlayer/master/download/accounts/serializers.py
app/applicationlayer/master/download/accounts/serializers.py
+0
-22
app/applicationlayer/master/download/accounts/views.py
app/applicationlayer/master/download/accounts/views.py
+0
-88
app/applicationlayer/master/urls.py
app/applicationlayer/master/urls.py
+0
-2
No files found.
app/applicationlayer/download/accounts/views.py
View file @
4b57d7c4
...
@@ -5,7 +5,7 @@ from drf_renderer_xlsx.renderers import XLSXRenderer
...
@@ -5,7 +5,7 @@ from drf_renderer_xlsx.renderers import XLSXRenderer
from
app.entities.models
import
(
from
app.entities.models
import
(
User
User
)
)
from
app.applicationlayer.
master.
download.accounts.serializers
import
headers
from
app.applicationlayer.download.accounts.serializers
import
headers
from
django.db.models
import
CharField
,
Value
from
django.db.models
import
CharField
,
Value
from
django.db.models
import
Q
from
django.db.models
import
Q
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
...
@@ -27,23 +27,15 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
...
@@ -27,23 +27,15 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
company
=
self
.
request
.
user
.
department
.
company
.
code
company
=
self
.
request
.
user
.
department
.
company
.
code
department
=
self
.
request
.
user
.
department
.
code
department
=
self
.
request
.
user
.
department
.
code
print
(
user_type
)
print
(
company
)
print
(
department
)
if
user_type
==
'CUA'
:
if
user_type
==
'CUA'
:
print
(
'cua'
)
data
=
User
.
objects
.
filter
(
data
=
User
.
objects
.
filter
(
department__company
=
company
)
.
exclude
(
id
=
1
)
department__company
=
company
)
.
exclude
(
id
=
1
)
elif
user_type
==
'DUA'
:
elif
user_type
==
'DUA'
:
print
(
'dua'
)
data
=
User
.
objects
.
filter
(
data
=
User
.
objects
.
filter
(
department
=
department
)
.
exclude
(
id
=
1
)
department
=
department
)
.
exclude
(
id
=
1
)
elif
user_type
==
'SU'
:
elif
user_type
==
'SU'
:
print
(
'su'
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
elif
user_type
==
'OUA'
:
elif
user_type
==
'OUA'
:
print
(
'oua'
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
else
:
else
:
return
Response
(
return
Response
(
...
...
app/applicationlayer/master/download/accounts/serializers.py
deleted
100644 → 0
View file @
d3b1fb87
from
app.entities
import
models
from
rest_framework
import
serializers
from
django.db.models
import
Q
class
headers
(
serializers
.
ModelSerializer
):
def
to_representation
(
self
,
instance
):
ret
=
super
()
.
to_representation
(
instance
)
ret
[
'deparment'
]
=
instance
.
department
.
name
ret
[
'company'
]
=
instance
.
department
.
company
.
name
return
ret
class
Meta
:
model
=
models
.
User
fields
=
(
'code'
,
'name'
,
'email'
,
'contact_no'
)
app/applicationlayer/master/download/accounts/views.py
deleted
100644 → 0
View file @
d3b1fb87
from
rest_framework
import
viewsets
as
meviewsets
from
rest_framework.viewsets
import
ReadOnlyModelViewSet
from
drf_renderer_xlsx.mixins
import
XLSXFileMixin
from
drf_renderer_xlsx.renderers
import
XLSXRenderer
from
app.entities.models
import
(
User
)
from
app.applicationlayer.master.download.accounts.serializers
import
headers
from
django.db.models
import
CharField
,
Value
from
django.db.models
import
Q
from
rest_framework.response
import
Response
from
rest_framework.permissions
import
AllowAny
from
rest_framework.exceptions
import
ParseError
from
rest_framework
import
status
class
UserDownloadRequest
(
XLSXFileMixin
,
ReadOnlyModelViewSet
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
headers
renderer_classes
=
(
XLSXRenderer
,)
filename
=
'User List.xlsx'
permission_classes
=
(
AllowAny
,)
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
user_type
=
self
.
request
.
user
.
user_type
company
=
self
.
request
.
user
.
department
.
company
.
code
department
=
self
.
request
.
user
.
department
.
code
print
(
user_type
)
print
(
company
)
print
(
department
)
if
user_type
==
'CUA'
:
print
(
'cua'
)
data
=
User
.
objects
.
filter
(
department__company
=
company
)
.
exclude
(
id
=
1
)
elif
user_type
==
'DUA'
:
print
(
'dua'
)
data
=
User
.
objects
.
filter
(
department
=
department
)
.
exclude
(
id
=
1
)
elif
user_type
==
'SU'
:
print
(
'su'
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
elif
user_type
==
'OUA'
:
print
(
'oua'
)
data
=
User
.
objects
.
all
()
.
exclude
(
id
=
1
)
else
:
return
Response
(
{
"message"
:
"Logged user is unauthorize to access this section"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
serializer
=
headers
(
data
=
data
,
many
=
True
)
serializer
.
is_valid
(
raise_exception
=
False
)
return
Response
(
serializer
.
data
)
column_header
=
{
'titles'
:
[
'ID_NUMBER'
,
'Name'
,
'Email'
,
'Contact Number'
,
'Department'
,
'Company'
],
'column_width'
:
[
17
,
30
,
17
],
'height'
:
25
,
'style'
:
{
'alignment'
:
{
'horizontal'
:
'center'
,
'vertical'
:
'center'
,
'wrapText'
:
False
,
'shrink_to_fit'
:
True
,
},
'border_side'
:
{
'border_style'
:
'thin'
,
'color'
:
'FF000000'
,
},
'font'
:
{
'name'
:
'Arial'
,
'size'
:
14
,
'bold'
:
True
,
'color'
:
'FF000000'
,
},
},
}
app/applicationlayer/master/urls.py
View file @
4b57d7c4
...
@@ -6,14 +6,12 @@ from app.applicationlayer.master.company.views import AdminCompanyViewSet
...
@@ -6,14 +6,12 @@ from app.applicationlayer.master.company.views import AdminCompanyViewSet
from
app.applicationlayer.master.department.views
import
AdminDepartmentViewSet
from
app.applicationlayer.master.department.views
import
AdminDepartmentViewSet
from
app.applicationlayer.master.user_type.views
import
UserTypeViewSet
from
app.applicationlayer.master.user_type.views
import
UserTypeViewSet
from
app.applicationlayer.master.attachment.views
import
MasterAttachmentViewSet
from
app.applicationlayer.master.attachment.views
import
MasterAttachmentViewSet
from
app.applicationlayer.master.download.accounts.views
import
UserDownloadRequest
router
=
routers
.
DefaultRouter
()
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'users'
,
AdminAccountViewSet
)
router
.
register
(
r'users'
,
AdminAccountViewSet
)
router
.
register
(
r'companies'
,
AdminCompanyViewSet
)
router
.
register
(
r'companies'
,
AdminCompanyViewSet
)
router
.
register
(
r'departments'
,
AdminDepartmentViewSet
)
router
.
register
(
r'departments'
,
AdminDepartmentViewSet
)
router
.
register
(
r'attachments'
,
MasterAttachmentViewSet
)
router
.
register
(
r'attachments'
,
MasterAttachmentViewSet
)
router
.
register
(
r'user-download'
,
UserDownloadRequest
)
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
include
(
router
.
urls
)),
path
(
''
,
include
(
router
.
urls
)),
...
...
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