Commit 3157af7b authored by John Red Medrano's avatar John Red Medrano

added can_delete field on list of template to check if the instance can be delete or not

parent 2ebe8a2a
...@@ -51,6 +51,7 @@ class ChangeRequestTemplatesSerializer( ...@@ -51,6 +51,7 @@ class ChangeRequestTemplatesSerializer(
ret['created_by'] = instance.created_by_user.name ret['created_by'] = instance.created_by_user.name
return ret return ret
except Exception as e: except Exception as e:
ret['requested_to_company'] = "none" ret['requested_to_company'] = "none"
...@@ -90,6 +91,22 @@ class ChangeRequestTemplatesSerializerList( ...@@ -90,6 +91,22 @@ class ChangeRequestTemplatesSerializerList(
ret['department'] = instance.requested_to_department.name ret['department'] = instance.requested_to_department.name
ret['point_of_contact'] = instance.requested_to_user.name ret['point_of_contact'] = instance.requested_to_user.name
ret['created_by'] = instance.created_by_user.name ret['created_by'] = instance.created_by_user.name
child = models.ChangeRequestFormHeader.objects.filter(
template_no=instance.template_no
)
can_delete = ''
if child.count() > 0:
can_delete = False
else:
can_delete = True
ret['can_delete'] = can_delete
return ret return ret
except Exception as e: except Exception as e:
......
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