Commit 6ee70a0a authored by John Red Medrano's avatar John Red Medrano

added validation on cms User Priviledges dont allow same department under same company

parent 0be97e89
...@@ -84,10 +84,12 @@ class AllowedCompanyViewSet(viewsets.ModelViewSet): ...@@ -84,10 +84,12 @@ class AllowedCompanyViewSet(viewsets.ModelViewSet):
return Response(message, status=status.HTTP_400_BAD_REQUEST) return Response(message, status=status.HTTP_400_BAD_REQUEST)
except Exception as e: except Exception as e:
print('ddd')
error = 'adding the same departments under same Company is not allowed'
message = { message = {
'code': 500, 'code': 500,
'status': 'failed', 'status': 'failed',
'message': 'Request was not able to process' + str(e), 'message': error,
} }
return Response(str(e), return Response(message,
status=status.HTTP_500_INTERNAL_SERVER_ERROR) 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): ...@@ -1027,6 +1027,7 @@ class AllowedCompany(models.Model):
class Meta: class Meta:
db_table = 'allowed_company' db_table = 'allowed_company'
unique_together = ['company_pivot', 'group_pivots', 'id_number']
class ReminderTrigger(models.Model): 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