Commit 37621d4d authored by Gladys Forte's avatar Gladys Forte

Merge pull request #531 in RMS/api-main-service from gladys-dev2 to RMSv2

* commit '0e4f8c53':
  select_related
parents ca7d9461 0e4f8c53
......@@ -20,7 +20,10 @@ from django.db import IntegrityError
class AllowedCompanyViewSet(viewsets.ModelViewSet):
queryset = AllowedCompany.objects.all()
# queryset = AllowedCompany.objects.all()
queryset = AllowedCompany.objects.select_related(
'id_number', 'company_pivot', 'group_pivots'
).all()
serializer_class = AllowedCompanySerializer
pagination_class = CustomPagination
lookup_field = 'code'
......
......@@ -8,6 +8,7 @@ class ChangeRequestFormApproversSerializer(
):
def to_representation(self, instance):
ret = super().to_representation(instance)
print(instance)
try:
ret['company'] = {
"id": instance.user.department.company.id,
......
......@@ -11,7 +11,6 @@ class headers(serializers.ModelSerializer):
return ret
class Meta:
model = models.Company
fields = (
......
......@@ -22,8 +22,6 @@ from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
# path('admin/', admin.site.urls),
path('api-auth/', include('rest_framework.urls')),
......
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