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
3945e1ed
Commit
3945e1ed
authored
Sep 16, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added endpoint list of user to change request application
parent
1ff80f8e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
5 deletions
+82
-5
app/accesslayer/views.py
app/accesslayer/views.py
+2
-2
app/applicationlayer/cms/template/views.py
app/applicationlayer/cms/template/views.py
+64
-2
app/applicationlayer/cms/urls_cms.py
app/applicationlayer/cms/urls_cms.py
+1
-0
app/applicationlayer/management/account/serializer.py
app/applicationlayer/management/account/serializer.py
+14
-0
app/applicationlayer/management/module/views.py
app/applicationlayer/management/module/views.py
+1
-1
No files found.
app/accesslayer/views.py
View file @
3945e1ed
...
@@ -83,8 +83,8 @@ class RefreshToken(APIView):
...
@@ -83,8 +83,8 @@ class RefreshToken(APIView):
class
CurrentUser
(
APIView
):
class
CurrentUser
(
APIView
):
#
@decorators.error_safe
@
decorators
.
error_safe
def
get
(
self
,
request
,
token
=
None
,
*
ar
UserManagementRetreiveSerializer
gs
,
**
kwargs
):
def
get
(
self
,
request
,
token
=
None
,
*
args
,
**
kwargs
):
serializer
=
UserManagementRetreiveSerializer
serializer
=
UserManagementRetreiveSerializer
context
=
{
"request"
:
request
}
context
=
{
"request"
:
request
}
...
...
app/applicationlayer/cms/template/views.py
View file @
3945e1ed
...
@@ -20,7 +20,7 @@ import requests
...
@@ -20,7 +20,7 @@ import requests
from
django.conf
import
settings
from
django.conf
import
settings
from
rest_framework.exceptions
import
ValidationError
from
rest_framework.exceptions
import
ValidationError
from
django.db
import
transaction
,
IntegrityError
,
connection
from
django.db
import
transaction
,
IntegrityError
,
connection
from
app.applicationlayer.utils
import
QuerySetHelper
from
app.applicationlayer.utils
import
QuerySetHelper
,
CustomPagination
,
status_message_response
from
app.businesslayer.changerequest
import
change_request
from
app.businesslayer.changerequest
import
change_request
from
app.applicationlayer.cms.utils_cr
import
number_generator
,
crhistory_save
from
app.applicationlayer.cms.utils_cr
import
number_generator
,
crhistory_save
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
...
@@ -28,7 +28,69 @@ from django.shortcuts import get_object_or_404
...
@@ -28,7 +28,69 @@ from django.shortcuts import get_object_or_404
from
rest_framework.generics
import
GenericAPIView
from
rest_framework.generics
import
GenericAPIView
from
rest_framework.mixins
import
UpdateModelMixin
from
rest_framework.mixins
import
UpdateModelMixin
from
django.forms.models
import
model_to_dict
from
django.forms.models
import
model_to_dict
from
app.entities
import
enums
from
app.entities
import
enums
,
models
from
app.applicationlayer.management.account.serializer
import
ChangeRequestList
class
UserList
(
APIView
):
pagination_class
=
CustomPagination
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
try
:
serializer
=
ChangeRequestList
dept
=
self
.
request
.
query_params
[
'department_id'
]
queryset
=
models
.
User
.
objects
.
filter
(
department
=
dept
)
.
order_by
(
'name'
)
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
ChangeRequestList
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'list of User found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
except
Exception
as
e
:
return
Response
(
{
"message"
:
"this endpoint expect a query params department_id"
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
@
property
def
paginator
(
self
):
"""
The paginator instance associated with the view, or `None`.
"""
if
not
hasattr
(
self
,
'_paginator'
):
if
self
.
pagination_class
is
None
:
self
.
_paginator
=
None
else
:
self
.
_paginator
=
self
.
pagination_class
()
return
self
.
_paginator
def
paginate_queryset
(
self
,
queryset
):
"""
Return a single page of results, or `None` if pagination is disabled.
"""
if
self
.
paginator
is
None
:
return
None
return
self
.
paginator
.
paginate_queryset
(
queryset
,
self
.
request
,
view
=
self
)
def
get_paginated_response
(
self
,
data
):
"""
Return a paginated style `Response` object for the given output data.
"""
assert
self
.
paginator
is
not
None
return
self
.
paginator
.
get_paginated_response
(
data
)
class
ChangeRequestTemplatesViewset
(
meviewsets
.
ModelViewSet
):
class
ChangeRequestTemplatesViewset
(
meviewsets
.
ModelViewSet
):
...
...
app/applicationlayer/cms/urls_cms.py
View file @
3945e1ed
...
@@ -27,4 +27,5 @@ urlpatterns = (
...
@@ -27,4 +27,5 @@ urlpatterns = (
path
(
''
,
include
(
router
.
urls
)),
path
(
''
,
include
(
router
.
urls
)),
path
(
'template-post/'
,
crtemplate_views
.
ChangeRequestTemplatePost
.
as_view
()),
path
(
'template-post/'
,
crtemplate_views
.
ChangeRequestTemplatePost
.
as_view
()),
path
(
'form-post/'
,
crform_views
.
ChangeRequestFormPost
.
as_view
()),
path
(
'form-post/'
,
crform_views
.
ChangeRequestFormPost
.
as_view
()),
path
(
'user-list/'
,
crtemplate_views
.
UserList
.
as_view
(),
name
=
"User List"
),
)
)
app/applicationlayer/management/account/serializer.py
View file @
3945e1ed
...
@@ -33,6 +33,20 @@ class UserSerializer(serializers.ModelSerializer):
...
@@ -33,6 +33,20 @@ class UserSerializer(serializers.ModelSerializer):
)
)
class
ChangeRequestList
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
User
fields
=
(
'id'
,
'code'
,
'name'
,
'username'
,
'contact_no'
,
'email'
,
'default_app'
,
'user_type'
,
'is_active'
,
'doa'
)
class
ChangePasswordSerializer
(
serializers
.
Serializer
):
class
ChangePasswordSerializer
(
serializers
.
Serializer
):
old_password
=
serializers
.
CharField
(
required
=
True
)
old_password
=
serializers
.
CharField
(
required
=
True
)
new_password
=
serializers
.
CharField
(
required
=
True
,
min_length
=
6
)
new_password
=
serializers
.
CharField
(
required
=
True
,
min_length
=
6
)
...
...
app/applicationlayer/management/module/views.py
View file @
3945e1ed
...
@@ -26,7 +26,7 @@ class ModuleViewSet(viewsets.ModelViewSet):
...
@@ -26,7 +26,7 @@ class ModuleViewSet(viewsets.ModelViewSet):
ordering_fields
=
'__all__'
ordering_fields
=
'__all__'
search_fields
=
(
search_fields
=
(
'name'
,
'application__name'
,
'name'
,
'application__name'
,
'code'
,
'component'
,
'sort_
number
'
'code'
,
'component'
,
'sort_
id
'
)
)
@
transaction
.
atomic
@
transaction
.
atomic
...
...
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