Commit 9b8e5800 authored by John Red Medrano's avatar John Red Medrano

added cms_settings key on current user endpoint

parent af9c9469
......@@ -8,7 +8,8 @@ from app.entities import enums
from django.db.models import Q
from app.applicationlayer.management.module.serializer import ModuleSerializer
from app.entities.models import (
User, Department, UserImage, AllowedCompany, Application, Module
User, Department, UserImage, AllowedCompany, Application, Module,
ChangeRequestSettings
)
......@@ -19,6 +20,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
company = serializers.SerializerMethodField()
create_form = serializers.SerializerMethodField()
create_template = serializers.SerializerMethodField()
cms_settings = serializers.SerializerMethodField()
class Meta:
model = User
......@@ -33,10 +35,28 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
'email', 'default_app',
'user_type', 'is_active',
'doa',
'cms_settings',
)
# exclude = ['password', 'application', 'groups', 'user_permissions']
def get_cms_settings(self, user):
data = ChangeRequestSettings.objects.filter(
active_user=str(user.code)
).values(
'behalf_user__name',
'behalf_user__code',
'behalf_approved',
'behalf_accepted',
'behalf_rejected',
'behalf_implemented',
'behalf_completed',
)
return data
def get_department(self, user):
data = {
"id": user.department.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment