Commit 475a8b1b authored by Gladys Forte's avatar Gladys Forte

Merge branch 'core-dev-gladys' into 'feature-prod-view-all-template'

Core dev gladys

See merge request rms/Backend/api-main-service!894
parents e6f80cce 3a6a5bdf
......@@ -33,7 +33,7 @@ class AllowedCompanyViewSet(viewsets.ModelViewSet):
)
def list(self, request, *args, **kwargs):
# hello again
queryset = self.filter_queryset(self.get_queryset())
page = self.paginate_queryset(queryset)
......
......@@ -45,12 +45,26 @@ class ChangeRequestTemplatesSerializer(
"code": instance.requested_to_department.code,
"name": instance.requested_to_department.name
}
created_by_user_object = {
"id": instance.created_by_user.id,
"name": instance.created_by_user.name,
"username": instance.created_by_user.username,
"code": instance.created_by_user.code,
"email": instance.created_by_user.email,
"contact_no": instance.created_by_user.contact_no,
"company_code": instance.created_by_user.department.company.code,
"company_name": instance.created_by_user.department.company.name,
"department_code": instance.created_by_user.department.code,
"department_name": instance.created_by_user.department.name
}
ret['requested_to_user'] = requested_to_user_object
ret['company'] = instance.requested_to_company.name
ret['department'] = instance.requested_to_department.name
ret['point_of_contact'] = instance.requested_to_user.name
ret['created_by'] = instance.created_by_user.name
ret['created_by_user'] = created_by_user_object
return ret
......@@ -59,11 +73,11 @@ class ChangeRequestTemplatesSerializer(
ret['requested_to_company'] = "none"
ret['requested_to_department'] = "none"
ret['requested_to_user'] = "none"
ret['created_by_user'] = "none"
ret['company'] = "none"
ret['department'] = "none"
ret['point_of_contact'] = "none"
ret['created_by'] = "none"
return ret
......
......@@ -22,7 +22,7 @@ class UserDownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
permission_classes = (AllowAny,)
def list(self, request, *args, **kwargs):
#comment this line
user_type = self.request.user.user_type
company = self.request.user.department.company.code
department = self.request.user.department.code
......
......@@ -1106,6 +1106,7 @@ class AllowedCompany(models.Model):
created_at = models.DateTimeField(auto_now_add=True)
deleted_at = models.DateTimeField(null=True, blank=True)
class Meta:
db_table = 'allowed_company'
unique_together = ['company_pivot', 'group_pivots', 'id_number']
......
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