Commit 6d6a118e authored by Gladys Forte's avatar Gladys Forte

Merge branch 'RMSv2' of http://42.61.118.105:7990/scm/rms/api-main-service into gladys-dev2

parents 08e83721 0772dbfd
......@@ -16,6 +16,7 @@ from app.applicationlayer.cms.allowed_company.table_filter import (
)
from django.db import transaction
from rest_framework.exceptions import ValidationError
from django.db import IntegrityError
class AllowedCompanyViewSet(viewsets.ModelViewSet):
......@@ -83,11 +84,24 @@ class AllowedCompanyViewSet(viewsets.ModelViewSet):
}
return Response(message, status=status.HTTP_400_BAD_REQUEST)
except IntegrityError as e:
print(str(e))
error = 'adding the same departments under same Company is not allowed'
message = {
'code': 400,
'status': 'failed',
'message': error,
}
return Response(message,
status=status.HTTP_400_BAD_REQUEST)
except Exception as e:
# print(str(e))
# error = 'adding the same departments under same Company is not allowed'
message = {
'code': 500,
'status': 'failed',
'message': 'Request was not able to process' + str(e),
'message': str(e),
}
return Response(str(e),
return Response(message,
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
# Generated by Django 2.2 on 2019-10-22 17:17
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('entities', '0024_auto_20191022_1433'),
]
operations = [
migrations.AlterUniqueTogether(
name='allowedcompany',
unique_together={('company_pivot', 'group_pivots')},
),
]
# Generated by Django 2.2 on 2019-10-22 17:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('entities', '0025_auto_20191022_1717'),
]
operations = [
migrations.AlterUniqueTogether(
name='allowedcompany',
unique_together={('company_pivot', 'group_pivots', 'id_number')},
),
]
......@@ -1027,6 +1027,7 @@ class AllowedCompany(models.Model):
class Meta:
db_table = 'allowed_company'
unique_together = ['company_pivot', 'group_pivots', 'id_number']
class ReminderTrigger(models.Model):
......
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