Commit bf763bd1 authored by Gladys Forte's avatar Gladys Forte

{dev bugfix} clean imports

parent e87e33b8
......@@ -2,6 +2,7 @@ from rest_framework import serializers
from app.entities.models import AllowedCompany
from app.applicationlayer.utils import model_to_dict
class AllowedCompanySerializer(serializers.ModelSerializer):
def to_representation(self, instance):
......
from django_filters import rest_framework as filters
from django.db.models import Count
from app.entities.models import AllowedCompany
from django.db.models import Q
......
# from rest_framework.views import APIView
from rest_framework import status, viewsets
from rest_framework.response import Response
from app.entities import enums
from app.entities.models import AllowedCompany
from app.applicationlayer.utils import CustomPagination, status_message_response
# from rest_framework.exceptions import ParseError
from app.applicationlayer.utils import (CustomPagination,
status_message_response)
from django_filters import rest_framework as filters
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.filters import SearchFilter, OrderingFilter
......@@ -20,7 +18,6 @@ from django.db import IntegrityError
class AllowedCompanyViewSet(viewsets.ModelViewSet):
# queryset = AllowedCompany.objects.all()
queryset = AllowedCompany.objects.select_related(
'id_number', 'company_pivot', 'group_pivots'
).all()
......@@ -34,8 +31,7 @@ class AllowedCompanyViewSet(viewsets.ModelViewSet):
'id_number__code', 'company_pivot__code',
'group_pivots__code'
)
# @decorators.rms.user_list
def list(self, request, *args, **kwargs):
queryset = self.filter_queryset(self.get_queryset())
......
......@@ -2,11 +2,8 @@ from app.entities import models
from datetime import datetime
from rest_framework.response import Response
from rest_framework import status, views
from django.db.models import Q
import requests
from django.conf import settings
from datetime import timedelta
from app.helper.email_service import sender
from app.applicationlayer.utils import main_threading
from rest_framework.permissions import AllowAny
......@@ -26,7 +23,7 @@ class CancelTriggerAPIView(views.APIView):
list_of_emails = []
for data in today_mail:
if data.is_sent == False and data.form_code.status == 'Pending' and data.frm_approver.is_action == True:
if data.is_sent is False and data.form_code.status == 'Pending' and data.frm_approver.is_action is True:
cr_link = f'{CR_FRONT_LINK}/{data.form_code}'
......@@ -44,7 +41,7 @@ class CancelTriggerAPIView(views.APIView):
requestor_recipient = data.form_code.requested_by_user.email
admin = 'Test'
args_requestor = [requestor_name, auto_cancel_date,
args_requestor = [requestor_name, auto_cancel_date,
date_submitted_last_approver, approver_pending_action,
cr_number, cr_name, company_requestedto,
department_requestedto, priority_level, form_status, url,
......
......@@ -2,11 +2,8 @@ from app.entities import models
from datetime import datetime
from rest_framework.response import Response
from rest_framework import status, views
from django.db.models import Q
import requests
from django.conf import settings
from datetime import timedelta
from app.helper.email_service import sender
from app.applicationlayer.utils import main_threading
from rest_framework.permissions import AllowAny
......@@ -27,7 +24,7 @@ class OverdueTriggerAPIView(views.APIView):
list_of_emails = []
for data in today_mail:
if data.is_sent == False and (data.form_code.status == 'Pending' or
if data.is_sent is False and (data.form_code.status == 'Pending' or
data.form_code.status == 'Approved' or
data.form_code.status == 'Rejected'):
......
......@@ -2,9 +2,7 @@ from app.entities import models
from datetime import datetime
from rest_framework.response import Response
from rest_framework import status, views
from django.db.models import Q
import requests
from django.conf import settings
from datetime import timedelta
from app.helper.email_service import sender
......@@ -29,7 +27,7 @@ class ReminderTriggerAPIView(views.APIView):
list_of_emails = []
for data in today_mail:
if data.frm_approver.is_action == True and data.form_code.status == 'Pending':
if data.frm_approver.is_action is True and data.form_code.status == 'Pending':
# common details
cr_link = f'{CR_FRONT_LINK}/{data.frm_approver.form_code}'
......
from app.entities import models
from rest_framework import serializers
from app.applicationlayer.utils import model_to_dict
class ChangeRequestFormApproversSerializer(
......
......@@ -12,8 +12,7 @@ from app.applicationlayer.utils import (
class ChangeRequestFormApproversViewset(viewsets.ModelViewSet):
# queryset = models.ChangeRequestFormApprovers.objects.all().order_by('level')
queryset = models.ChangeRequestFormApprovers.objects.select_related(
'form_code', 'tmp_approver'
).all().order_by('level')
......
from app.entities import models
from rest_framework import serializers
from app.applicationlayer.utils import model_to_dict
class ChangeRequestFormAttachmentsSerializer(
......
from app.entities import models
from rest_framework import serializers
from app.applicationlayer.utils import model_to_dict
class ChangeRequestFormDetailsSerializer(
......
......@@ -12,8 +12,7 @@ from app.applicationlayer.utils import (
class ChangeRequestFormDetailsViewset(viewsets.ModelViewSet):
# queryset = models.ChangeRequestFormDetails.objects.all()
queryset = models.ChangeRequestFormDetails.objects.select_related(
'form_code'
).all()
......
from rest_framework import viewsets as meviewsets
from rest_framework.viewsets import ReadOnlyModelViewSet
from drf_renderer_xlsx.mixins import XLSXFileMixin
from drf_renderer_xlsx.renderers import XLSXRenderer
from app.entities.models import (
ChangeRequestFormHeader,
ChangeRequestFormApprovers,
ChangeRequestFormStakeHolders,
AllowedCompany
)
# from app.applicationlayer.form_listing_ import headers
from app.applicationlayer.cms.form.download.serializers import headers
from django.db.models import CharField, Value
from django.db.models import Q
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
# from cms.applicationlayer.utilities import logged_user
class DownloadRequest(XLSXFileMixin, ReadOnlyModelViewSet):
......
import configparser
import shutil
import os
from django.shortcuts import render
from rest_framework import viewsets
from rest_framework.views import APIView
from app.entities import models
from datetime import datetime
from datetime import timedelta
from rest_framework.response import Response
from rest_framework import status, views
from rest_framework.decorators import action
from django.http import Http404
from django.db.models import Q
import requests
from django.conf import settings
from rest_framework.exceptions import ValidationError
from django.db import transaction, IntegrityError, connection
from app.applicationlayer.utils import (QuerySetHelper,
status_message_response,
send_broadcast_message)
from django.db import transaction
from app.applicationlayer.utils import (status_message_response,
send_broadcast_message,
CustomPagination,
model_to_dict,
main_threading,
error_message)
from app.businesslayer.changerequest import (change_request,
change_request_template)
from app.applicationlayer.cms.utils_cr import (number_generator,
send_mail_requestor,
next_approver_email,
from app.applicationlayer.cms.utils_cr import (next_approver_email,
crhistory_save,
send_mail_vendor,
get_max_batchno,
generate_template_id,
crhistory_create_save,
entity_log_bulk,
reminder_trigger_save,
overdue_trigger_save,
reset_autoemail_tables,
delete_master_attachment_file)
from app.entities import enums
from app.applicationlayer.utils import model_to_dict
import json
from django.shortcuts import get_object_or_404
from django.db.models import Min
from app.applicationlayer.utils import (CustomPagination,
status_message_response)
from rest_framework.exceptions import ParseError
from app.businesslayer.changerequest.change_request import (
form_add_edit_delete
)
......@@ -66,8 +58,6 @@ from app.applicationlayer.cms.form.header.table_filters import HeaderFilterSet
from rest_framework.filters import SearchFilter, OrderingFilter
from django_filters import rest_framework as filters
from django_filters.rest_framework import DjangoFilterBackend
import json
from app.applicationlayer.utils import main_threading
from django.core.files.base import ContentFile
from django.conf import settings
......@@ -76,9 +66,6 @@ from django.http import HttpResponse
from xhtml2pdf import pisa
from app.helper.decorators import *
from app.applicationlayer.utils import error_message
config = configparser.ConfigParser()
config_file = os.path.join('./', 'env.ini')
config.read(config_file)
......@@ -223,22 +210,6 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
overdue_filtered = change_request.filter_overdue(self.queryset)
overdue = overdue_filtered.count()
# server side computations
# status_total = pending + approved + rejected + cancelled + completed
# close = rejected + cancelled + completed
# opened = pending + approved
# open_percent = round((opened/status_total) * 100)
# close_percent = round((close/status_total) * 100)
# priority_total = high + normal
# high_percent = round((high/priority_total) * 100)
# normal_percent = round((normal/priority_total) * 100)
message = {
'account_no': id_number,
......@@ -251,10 +222,6 @@ class ChangeRequestFormsViewset(viewsets.ModelViewSet):
'normal': normal,
'awaiting': awaiting,
'overdue': overdue,
# 'open_percent': open_percent,
# 'close_percent': close_percent,
# 'high_percent': high_percent,
# 'normal_percent': normal_percent,
'code': 200,
'status': 'success',
'message': 'Dashboard Summary'
......
......@@ -12,7 +12,7 @@ from app.applicationlayer.utils import (
class ChangeRequestFormStakeHoldersViewset(viewsets.ModelViewSet):
# queryset = models.ChangeRequestFormStakeHolders.objects.all()
queryset = models.ChangeRequestFormStakeHolders.objects.select_related(
'form_code'
).all()
......
......@@ -4,7 +4,6 @@ from app.applicationlayer.utils import (CustomPagination,
from app.applicationlayer.management.account.serializer import ChangeRequestList
from app.entities import models
from rest_framework.response import Response
from django.db.models import Q
from rest_framework import status
......
from django_filters import rest_framework as filters
from django.db.models import Count
from app.entities.models import Company
from django.db.models import Q
......
......@@ -2,7 +2,7 @@ from rest_framework.filters import SearchFilter, OrderingFilter
from django_filters import rest_framework as filters
from app.entities.models import (
Company, AllowedCompany,
ChangeRequestFormHeader, AllowedCompany
ChangeRequestFormHeader
)
from rest_framework import viewsets, status
from app.businesslayer.company.serializer import AdminCompanySerializer
......
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