Commit b7a13b7c authored by John Red Medrano's avatar John Red Medrano

alter the value of app_code at current user

parent 47fddd2e
......@@ -39,27 +39,21 @@ class UserManagementRoleSerializer(serializers.ModelSerializer):
class UserManagementRetreiveSerializer(serializers.ModelSerializer):
image = serializers.SerializerMethodField()
applications = serializers.SerializerMethodField()
# department_name = serializers.ReadOnlyField(source='department.name')
# department_id = serializers.ReadOnlyField(source='department.id')
department = serializers.SerializerMethodField()
company = serializers.SerializerMethodField()
# role = UserManagementRoleSerializer()
# special_permissions = serializers.SlugRelatedField(many=True,
# read_only=True,
# slug_field='code')
class Meta:
model = models.User
fields = (
'id', 'image', 'company', 'department', 'applications',
'last_login', 'is_superuser',
'first_name', 'last_name',
'is_staff', 'is_active',
'date_joined', 'user_type',
'id',
'code', 'name',
'username', 'contact_no',
'email', 'doa',
'default_app',
'image', 'company',
'department', 'applications',
'email', 'default_app',
'user_type', 'is_active',
'doa',
)
# exclude = ['password', 'application', 'groups', 'user_permissions']
......@@ -92,7 +86,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
app = user.application.all()
list_app = []
for data in app:
if user.user_type.upper() == 'USR' and data.app_code.upper() == 'RMS':
if user.user_type.upper() == 'USR' and data.id == 1:
pass
else:
remove = ['Modules', 'Companies', 'Department']
......@@ -118,7 +112,7 @@ class UserManagementRetreiveSerializer(serializers.ModelSerializer):
# list_mod.append(body)
app_body = {}
app_body['app_code'] = data.app_code.lower()
app_body['app_code'] = data.code
app_body['name'] = data.name
app_body['modules'] = mod
list_app.append(app_body)
......
# Generated by Django 2.2 on 2019-09-09 17:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('entities', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='application',
name='app_code',
),
]
......@@ -26,7 +26,6 @@ class Application(AuditClass):
max_length=255
)
name = models.CharField(unique=True, max_length=255)
app_code = models.CharField(max_length=255)
class Meta:
db_table = 'applications'
......
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