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

modify company and department value to instance value

parent 0c37650e
......@@ -4,6 +4,7 @@ import ast
from django.contrib.auth.hashers import make_password, check_password
import re
from django.contrib.auth import authenticate
from django.forms.models import model_to_dict
class UserSerializer(serializers.ModelSerializer):
......@@ -19,8 +20,8 @@ class UserSerializer(serializers.ModelSerializer):
# ).values().first()
ret = super().to_representation(instance)
ret['department_name'] = instance.department.name
ret['company_name'] = instance.department.company.name
ret['department'] = model_to_dict(instance.department)
ret['company'] = model_to_dict(instance.department.company)
return ret
class Meta:
......@@ -29,7 +30,6 @@ class UserSerializer(serializers.ModelSerializer):
'id',
'code', 'name',
'username', 'contact_no',
'department',
'email', 'default_app',
'user_type', 'is_active',
'doa'
......
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