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
50408832
Commit
50408832
authored
Sep 23, 2019
by
John Red Medrano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reverse logic on master and manage
parent
082c45e7
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
7 deletions
+79
-7
app/applicationlayer/management/account/table_filters.py
app/applicationlayer/management/account/table_filters.py
+1
-1
app/applicationlayer/management/account/views.py
app/applicationlayer/management/account/views.py
+2
-2
app/applicationlayer/management/company/views.py
app/applicationlayer/management/company/views.py
+1
-1
app/applicationlayer/management/department/views.py
app/applicationlayer/management/department/views.py
+1
-1
app/applicationlayer/master/Account/serializer.py
app/applicationlayer/master/Account/serializer.py
+22
-0
app/applicationlayer/master/Account/views.py
app/applicationlayer/master/Account/views.py
+48
-0
app/applicationlayer/master/company/views.py
app/applicationlayer/master/company/views.py
+1
-1
app/applicationlayer/master/department/views.py
app/applicationlayer/master/department/views.py
+1
-1
app/applicationlayer/master/urls.py
app/applicationlayer/master/urls.py
+2
-0
No files found.
app/applicationlayer/management/account/table_filters.py
View file @
50408832
...
@@ -4,7 +4,7 @@ from app.entities.models import User
...
@@ -4,7 +4,7 @@ from app.entities.models import User
from
django.db.models
import
Q
from
django.db.models
import
Q
class
UserFilterS
et
(
filters
.
FilterSet
):
class
AccountFilters
et
(
filters
.
FilterSet
):
# search = filters.CharFilter(method='search_bar', label='search')
# search = filters.CharFilter(method='search_bar', label='search')
# def search_bar(self, queryset, name, value):
# def search_bar(self, queryset, name, value):
# return queryset.filter(
# return queryset.filter(
...
...
app/applicationlayer/management/account/views.py
View file @
50408832
...
@@ -18,7 +18,7 @@ from django.contrib.auth.hashers import make_password
...
@@ -18,7 +18,7 @@ from django.contrib.auth.hashers import make_password
from
django_filters.rest_framework
import
DjangoFilterBackend
from
django_filters.rest_framework
import
DjangoFilterBackend
from
rest_framework.filters
import
SearchFilter
,
OrderingFilter
from
rest_framework.filters
import
SearchFilter
,
OrderingFilter
from
app.applicationlayer.management.account
import
serializer
from
app.applicationlayer.management.account
import
serializer
from
app.applicationlayer.management.account.table_filters
import
UserFilterS
et
from
app.applicationlayer.management.account.table_filters
import
AccountFilters
et
from
app.applicationlayer.utils
import
(
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
,
log_save
,
CustomPagination
,
status_message_response
,
log_save
,
main_threading
main_threading
...
@@ -32,7 +32,7 @@ class UserViewSet(viewsets.ModelViewSet):
...
@@ -32,7 +32,7 @@ class UserViewSet(viewsets.ModelViewSet):
pagination_class
=
CustomPagination
pagination_class
=
CustomPagination
lookup_field
=
'code'
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
UserFilterS
et
filterset_class
=
AccountFilters
et
ordering_fields
=
'__all__'
ordering_fields
=
'__all__'
search_fields
=
(
search_fields
=
(
'name'
,
'code'
,
'name'
,
'code'
,
...
...
app/applicationlayer/management/company/views.py
View file @
50408832
...
@@ -42,7 +42,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
...
@@ -42,7 +42,7 @@ class CompanyViewSet(viewsets.ModelViewSet):
message
message
)
)
#
@decorators.rms.company_list
@
decorators
.
rms
.
company_list
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
page
=
self
.
paginate_queryset
(
queryset
)
page
=
self
.
paginate_queryset
(
queryset
)
...
...
app/applicationlayer/management/department/views.py
View file @
50408832
...
@@ -42,7 +42,7 @@ class DepartmentViewSet(viewsets.ModelViewSet):
...
@@ -42,7 +42,7 @@ class DepartmentViewSet(viewsets.ModelViewSet):
message
message
)
)
#
@decorators.rms.department_list
@
decorators
.
rms
.
department_list
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
...
...
app/applicationlayer/master/Account/serializer.py
0 → 100644
View file @
50408832
from
rest_framework
import
serializers
from
app.entities.models
import
User
from
django.forms.models
import
model_to_dict
class
AdminAccountSerializer
(
serializers
.
ModelSerializer
):
def
to_representation
(
self
,
instance
):
ret
=
super
()
.
to_representation
(
instance
)
ret
[
'department'
]
=
model_to_dict
(
instance
.
department
)
ret
[
'company'
]
=
model_to_dict
(
instance
.
department
.
company
)
application
=
instance
.
application
.
values
()
ret
[
'application'
]
=
application
return
ret
class
Meta
:
model
=
User
fields
=
'__all__'
read_only_fields
=
(
'created'
,
'createdby'
,
'modified'
,
'modifiedby'
,
'code'
,
)
app/applicationlayer/master/Account/views.py
0 → 100644
View file @
50408832
from
rest_framework
import
viewsets
,
status
from
rest_framework.response
import
Response
from
django.forms.models
import
model_to_dict
from
rest_framework.filters
import
SearchFilter
,
OrderingFilter
from
django_filters
import
rest_framework
as
filters
from
app.entities.models
import
User
from
app.applicationlayer.utils
import
(
CustomPagination
,
status_message_response
)
from
django_filters.rest_framework
import
DjangoFilterBackend
from
app.applicationlayer.master.Account
import
serializer
from
app.applicationlayer.management.account.table_filters
import
AccountFilterset
from
app.helper.decorators
import
rms
class
AdminAccountViewSet
(
viewsets
.
ModelViewSet
):
queryset
=
User
.
objects
.
all
()
serializer_class
=
serializer
.
AdminAccountSerializer
pagination_class
=
CustomPagination
lookup_field
=
'code'
filter_backends
=
(
DjangoFilterBackend
,
SearchFilter
,
OrderingFilter
)
filterset_class
=
AccountFilterset
ordering_fields
=
'__all__'
search_fields
=
(
'name'
,
'company__name'
,
'code'
,
'department__name'
,
'email'
,
'contact_no'
,
)
# @rms.department_list
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
page
=
self
.
paginate_queryset
(
queryset
)
if
page
is
not
None
:
serializer
=
self
.
get_serializer
(
page
,
many
=
True
)
message
=
status_message_response
(
200
,
'success'
,
'list of User found'
,
serializer
.
data
)
return
self
.
get_paginated_response
(
message
)
serializer
=
self
.
get_serializer
(
queryset
,
many
=
True
)
return
Response
(
serializer
.
data
)
app/applicationlayer/master/company/views.py
View file @
50408832
...
@@ -22,7 +22,7 @@ class AdminCompanyViewSet(viewsets.ModelViewSet):
...
@@ -22,7 +22,7 @@ class AdminCompanyViewSet(viewsets.ModelViewSet):
search_fields
=
(
'name'
,
'name'
,
'contact_details'
)
search_fields
=
(
'name'
,
'name'
,
'contact_details'
)
http_method_names
=
[
'get'
]
http_method_names
=
[
'get'
]
@
rms
.
company_list
#
@rms.company_list
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
...
...
app/applicationlayer/master/department/views.py
View file @
50408832
...
@@ -24,7 +24,7 @@ class AdminDepartmentViewSet(viewsets.ModelViewSet):
...
@@ -24,7 +24,7 @@ class AdminDepartmentViewSet(viewsets.ModelViewSet):
ordering_fields
=
'__all__'
ordering_fields
=
'__all__'
search_fields
=
(
'name'
,
'company__name'
,
'code'
)
search_fields
=
(
'name'
,
'company__name'
,
'code'
)
@
rms
.
department_list
#
@rms.department_list
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
def
list
(
self
,
request
,
*
args
,
**
kwargs
):
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
queryset
=
self
.
filter_queryset
(
self
.
get_queryset
())
...
...
app/applicationlayer/master/urls.py
View file @
50408832
from
django.urls
import
path
,
include
from
django.urls
import
path
,
include
from
rest_framework
import
routers
from
rest_framework
import
routers
from
django.conf.urls
import
url
from
django.conf.urls
import
url
from
app.applicationlayer.master.Account.views
import
AdminAccountViewSet
from
app.applicationlayer.master.company.views
import
AdminCompanyViewSet
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
router
=
routers
.
DefaultRouter
()
router
=
routers
.
DefaultRouter
()
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'user-types', UserTypeViewSet)
# router.register(r'user-types', UserTypeViewSet)
...
...
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