ep signals bug
This commit is contained in:
parent
fe12351f72
commit
3f0d73416b
|
@ -93,6 +93,8 @@ class ChannelAuthoritySerializer(serializers.Serializer):
|
|||
|
||||
class EmployeeSerializer(EmployeeBaseSerializer):
|
||||
belong_dept_ = DeptSimpleSerializer(source='belong_dept', read_only=True)
|
||||
belong_dept_name = serializers.CharField(source='belong_dept.name', read_only=True)
|
||||
post_name = serializers.CharField(source='post.name', read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = Employee
|
||||
|
|
|
@ -9,13 +9,13 @@ def updateEmployee(sender, instance, created, **kwargs):
|
|||
# if created:
|
||||
if not instance.is_superuser:
|
||||
ep, ep_created = Employee.objects.get_or_create(user=instance,
|
||||
defaults={
|
||||
"user": instance,
|
||||
"name": instance.name,
|
||||
"phone": instance.phone,
|
||||
"belong_dept": instance.belong_dept,
|
||||
"post": instance.post
|
||||
})
|
||||
defaults={
|
||||
"user": instance,
|
||||
"name": instance.name,
|
||||
"phone": instance.phone,
|
||||
"belong_dept": instance.belong_dept,
|
||||
"post": instance.post
|
||||
})
|
||||
if not ep_created:
|
||||
ep.belong_dept = instance.belong_dept
|
||||
ep.post = instance.post
|
||||
|
|
Loading…
Reference in New Issue