def post(self, request, *args, **kwargs): user_id = request.POST.get('user_id') user_type_id = request.POST.get('user_type_id') currency = request.POST.get('currency') opening_page_index = request.POST.get('current_page_index') body = {} if user_id is not '': body['user_id'] = user_id if user_type_id is not '' and user_type_id is not '0': body['user_type'] = int(0 if user_type_id is None else user_type_id) if currency is not '': body['currency'] = currency if 'download' in request.POST: self.logger.info('========== Start export cash source of fund ==========') file_type = request.POST.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file(self, body=body, url_download=CASH_SOFS_URL, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info('========== End export cash source of fund ==========') return response else: self.logger.info('========== Start search cash source of fund ==========') data, success = self.get_cash_sof_list(body, opening_page_index) if not success: context = { 'sof_list': [], 'user_id': user_id, 'user_type_id': user_type_id, 'currency': currency, 'search_count': 0, 'is_show_export': False } return render(request, self.template_name, context) else: if data is not None: data = self.format_data(data) result_data = data.get('cash_sofs', []) page = data.get("page", {}) self.logger.info('Page: {}'.format(page)) context = { 'sof_list': result_data, 'user_id': user_id, 'user_type_id': user_type_id, 'currency': currency, 'search_count': page.get('total_elements', 0), 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'is_show_export': check_permissions_by_user(self.request.user,"CAN_EXPORT_CASH_SOF_INFORMATION") } self.logger.info('========== End search cash source of fund ==========') return render(request, self.template_name, context)
def get(self, request, *args, **kwargs): headers = self._get_headers() file_id = kwargs['file_id'] status_id = kwargs['status_id'] params = {'file_id': int(file_id), 'status_id': int(status_id)} self.logger.info('========== Start download file ==========') status_code, is_success, data = RestFulClient.download(url=DOWNLOAD_URL, headers=headers, loggers=self.logger, params=params) self.logger.info('========== Finished download file ==========') if is_success: response = make_download_file(data, 'csv') return response
def post(self, request, *args, **kwargs): context = super(ListView, self).get_context_data(**kwargs) self.logger.info('========== Start {} service groups list =========='.format("downloading" if 'download' in request.POST else "searching")) service_group_id = request.POST.get('service_group_id') service_group_name = request.POST.get('service_group_name') created_from_date = request.POST.get('created_from_date') created_to_date = request.POST.get('created_to_date') created_from_time = request.POST.get('created_from_time') created_to_time = request.POST.get('created_to_time') modified_from_date = request.POST.get('modified_from_date') modified_to_date = request.POST.get('modified_to_date') modified_from_time = request.POST.get('modified_from_time') modified_to_time = request.POST.get('modified_to_time') opening_page_index = request.POST.get('current_page_index') body = {'is_deleted': False} if service_group_id: body['service_group_id'] = service_group_id if service_group_name: body['service_group_name'] = service_group_name if created_from_date: body['from_created_timestamp'] = convert_string_to_date_time(created_from_date, created_from_time) if created_to_date: body['to_created_timestamp'] = convert_string_to_date_time(created_to_date, created_to_time) if modified_from_date: body['from_last_updated_timestamp'] = convert_string_to_date_time(modified_from_date, modified_from_time) if modified_to_date: body['to_last_updated_timestamp'] = convert_string_to_date_time(modified_to_date, modified_to_time) if 'download' in request.POST: file_type = request.POST.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file(self, body=body, url_download=api_settings.SERVICE_GROUP_LIST_PATH, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info('========== Finish exporting payment service ==========') return response else: body['paging'] = True body['page_index'] = int(opening_page_index) data, is_success = self.get_service_group_list(body) context.update({ 'service_group_id': service_group_id, 'service_group_name': service_group_name, 'created_from_date': created_from_date, 'created_to_date': created_to_date, 'created_from_time': created_from_time, 'created_to_time': created_to_time, 'modified_from_date': modified_from_date, 'modified_to_date': modified_to_date, 'modified_from_time': modified_from_time, 'modified_to_time': modified_to_time, }) if is_success: page = data.get("page", {}) context.update({ 'search_count': page.get('total_elements', 0), 'data': data['service_groups'], 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'is_show_export': check_permissions_by_user(self.request.user, 'CAN_EXPORT_SERVICE_GROUP') }) else: context.update({ 'data': [], 'is_show_export': False }) self.logger.info('========== Finish searching service groups list ==========') return render(request, self.template_name, context)
def get(self, request, *args, **kwargs): self.logger.info( '========== Start getting customer transaction history ==========') context = super(TransactionHistoryView, self).get_context_data(**kwargs) user_id = context['customerId'] user_type = UserType.CUSTOMER.value choices = self._get_choices_types() cash_sof_list = self._get_cash_sof_list(user_id, user_type).get( 'cash_sofs', []) body = {} body['paging'] = True body['page_index'] = 1 request.session['page_from'] = 'customer' request.session['customer_id'] = user_id sof_id = request.GET.get('sof_id') sof_type_id = request.GET.get('sof_type_id') opening_page_index = request.GET.get('current_page_index') from_created_timestamp = request.GET.get('from_created_timestamp') to_created_timestamp = request.GET.get('to_created_timestamp') status_id = request.GET.get('status_id') if status_id is not '' and status_id is not None: status_id = int(status_id) if sof_id is None and sof_type_id is None and opening_page_index is None and from_created_timestamp is None and to_created_timestamp is None: # Set first load default time for Context from_created_timestamp = datetime.now() to_created_timestamp = datetime.now() from_created_timestamp = from_created_timestamp.replace(hour=0, minute=0, second=1) to_created_timestamp = to_created_timestamp.replace(hour=23, minute=59, second=59) new_from_created_timestamp = from_created_timestamp.strftime( "%Y-%m-%dT%H:%M:%SZ") new_to_created_timestamp = to_created_timestamp.strftime( "%Y-%m-%dT%H:%M:%SZ") body['from_created_timestamp'] = new_from_created_timestamp new_from_created_timestamp = from_created_timestamp.strftime( "%Y-%m-%d") context['from_created_timestamp'] = new_from_created_timestamp body['to_created_timestamp'] = new_to_created_timestamp new_to_created_timestamp = to_created_timestamp.strftime( "%Y-%m-%d") context['to_created_timestamp'] = new_to_created_timestamp body['sof_type_id'] = SOFType.CASH.value body['user_type_id'] = UserType.CUSTOMER.value body['user_id'] = user_id order_balance_movements, page, summaries, success = self._get_transaction_history( body) if success: if order_balance_movements is not None: result_data = self.format_data(order_balance_movements) has_permission_view_payment_order_detail = check_permissions_by_user( self.request.user, 'CAN_VIEW_PAYMENT_ORDER_DETAIL') for i in order_balance_movements: i['has_permission_view_payment_order_detail'] = has_permission_view_payment_order_detail else: result_data = order_balance_movements self.logger.info("Page: {}".format(page)) context.update({ 'search_count': page.get('total_elements', 0), 'list': result_data, 'summaries': summaries, 'choices': choices, 'cash_sof_list': cash_sof_list, 'status_list': status_list, 'status_id': status_id, 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'user_id': user_id, 'is_show_export': check_permissions_by_user( self.request.user, 'CAN_EXPORT_CUSTOMER_INDIVIDUAL_WALLET') }) else: context.update({ 'search_count': 0, 'data': [], 'status_list': status_list, 'status_id': status_id, 'paginator': {}, 'user_id': user_id, 'is_show_export': False }) permissions = {} else: if sof_id is not '' and sof_id is not None: sof_id = int(sof_id) body['sof_id'] = sof_id if sof_type_id is not '' and sof_type_id is not None: body['sof_type_id'] = int(sof_type_id) body['user_type_id'] = UserType.CUSTOMER.value body['user_id'] = user_id if status_id is not '' and status_id is not None: body['status_id_list'] = [status_id] context = {} # validate required search date criteria if from_created_timestamp is '' or to_created_timestamp is '': messages.add_message( request, messages.ERROR, 'Please specify the to and from date search criteria') context.update({ 'search_count': 0, 'list': [], 'summaries': [], 'choices': choices, 'sof_type_id': sof_type_id, 'sof_id': sof_id, 'cash_sof_list': cash_sof_list, 'status_list': status_list, 'status_id': status_id, 'paginator': {}, 'user_id': user_id, 'from_created_timestamp': from_created_timestamp, 'to_created_timestamp': to_created_timestamp }) return render(request, self.template_name, context) diffDay = self._getDiffDaysFromUIDateValue(from_created_timestamp, to_created_timestamp) # validate fromDate less than or equals to toDate if diffDay < 0: messages.add_message( request, messages.ERROR, 'The from date should be before or equal to the to date') context.update({ 'search_count': 0, 'list': [], 'summaries': [], 'choices': choices, 'sof_type_id': sof_type_id, 'sof_id': sof_id, 'cash_sof_list': cash_sof_list, 'status_list': status_list, 'status_id': status_id, 'paginator': {}, 'user_id': user_id, 'from_created_timestamp': from_created_timestamp, 'to_created_timestamp': to_created_timestamp }) return render(request, self.template_name, context) # validate date range walletViewInDay = self._getWalletViewInDay() if diffDay > int(walletViewInDay): messages.add_message( request, messages.ERROR, 'Time range over ' + walletViewInDay + ' day(s) is not allowed') context.update({ 'search_count': 0, 'list': [], 'summaries': [], 'choices': choices, 'sof_type_id': sof_type_id, 'sof_id': sof_id, 'cash_sof_list': cash_sof_list, 'status_list': status_list, 'status_id': status_id, 'paginator': {}, 'user_id': user_id, 'from_created_timestamp': from_created_timestamp, 'to_created_timestamp': to_created_timestamp }) return render(request, self.template_name, context) # build date range critera for service new_from_created_timestamp = datetime.strptime( from_created_timestamp, self.dateUIFormat) new_from_created_timestamp = new_from_created_timestamp.strftime( '%Y-%m-%dT%H:%M:%SZ') body['from_created_timestamp'] = new_from_created_timestamp new_to_created_timestamp = datetime.strptime( to_created_timestamp, self.dateUIFormat) new_to_created_timestamp = new_to_created_timestamp.replace( hour=23, minute=59, second=59) new_to_created_timestamp = new_to_created_timestamp.strftime( '%Y-%m-%dT%H:%M:%SZ') body['to_created_timestamp'] = new_to_created_timestamp if 'download' in request.GET: self.logger.info('Exporting customer transaction history') file_type = request.GET.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file( self, body=body, url_download=BALANCE_MOVEMENT_LIST_PATH, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info( 'Export customer transaction history success') return response if 'search' in request.GET: self.logger.info('Searching customer transaction history') order_balance_movements, page, summaries, success = self._get_transaction_history( body) if success: if order_balance_movements is not None: result_data = self.format_data(order_balance_movements) has_permission_view_payment_order_detail = check_permissions_by_user( self.request.user, 'CAN_VIEW_PAYMENT_ORDER_DETAIL') for i in order_balance_movements: i['has_permission_view_payment_order_detail'] = has_permission_view_payment_order_detail else: result_data = order_balance_movements self.logger.info("Page: {}".format(page)) context.update({ 'search_count': page.get('total_elements', 0), 'list': result_data, 'summaries': summaries, 'choices': choices, 'sof_type_id': sof_type_id, 'sof_id': sof_id, 'cash_sof_list': cash_sof_list, 'status_list': status_list, 'status_id': status_id, 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'user_id': user_id, 'from_created_timestamp': from_created_timestamp, 'to_created_timestamp': to_created_timestamp, 'is_show_export': check_permissions_by_user( self.request.user, 'CAN_EXPORT_CUSTOMER_INDIVIDUAL_WALLET') }) else: context.update({ 'search_count': 0, 'data': [], 'status_list': status_list, 'status_id': status_id, 'paginator': {}, 'user_id': user_id, 'is_show_export': False }) self.logger.info('Finish search customer transaction history') request.session['customer_redirect_from_wallet_view'] = True request.session['back_wallet_url'] = request.build_absolute_uri() self.logger.info( '========== Finished getting customer transaction history ==========' ) return render(request, self.template_name, context)
def post(self, request, *args, **kwargs): params = {} context = {} name = request.POST.get('name') id = request.POST.get('id') currency = request.POST.get('currency') group = request.POST.get('group') status = request.POST.get('status') opening_page_index = request.POST.get('current_page_index') if id: context['id'] = id params['id'] = id if name: context['name'] = name params['service_name'] = name if currency: context['currency'] = currency params['currency'] = currency if group: context['group'] = group params['service_group_id'] = group if not status: params['status'] = 1 else: context['status'] = status if status in ['0', '1']: params['status'] = int(status) if 'download' in request.POST: self.logger.info( '========== Start exporting payment service ==========') file_type = request.POST.get('export-type') params['file_type'] = file_type params['row_number'] = 5000 is_success, data = export_file(self, body=params, url_download=SEARCH_SERVICE, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info( '========== Finish exporting payment service ==========') return response else: params['paging'] = True if opening_page_index: params['page_index'] = int(opening_page_index) context['current_page_index'] = int(opening_page_index) else: params['page_index'] = 1 permissions = { 'CAN_VIEW_SERVICE': check_permissions_by_user(self.request.user, 'CAN_VIEW_SERVICE'), 'CAN_EDIT_SERVICE': check_permissions_by_user(self.request.user, 'CAN_EDIT_SERVICE'), 'CAN_EDIT_COMMAND_SERVICE': check_permissions_by_user(self.request.user, 'CAN_EDIT_COMMAND_SERVICE'), 'CAN_DELETE_SERVICE': check_permissions_by_user(self.request.user, 'CAN_DELETE_SERVICE'), 'CAN_ADD_SERVICE': check_permissions_by_user(self.request.user, 'CAN_ADD_SERVICE') } success, data = self.get_services_list(params) if not success: context['data'] = [] context['service_groups'] = [] context['search_count'] = 0 context['permissions'] = permissions context['is_show_export'] = False return render(request, self.template_name, context) else: service_list = data.get('services') if success else [] page = data.get("page", {}) context['search_count'] = page.get('total_elements', 0) service_groups = [] if success: service_group_list = self.get_service_group_list() for i in service_list: for j in service_group_list: if i['service_group_id'] == j['service_group_id']: i['service_group_name'] = j[ 'service_group_name'] break for i in service_group_list: service_groups.append({ 'id': str(i['service_group_id']), 'name': i['service_group_name'] }) context['paginator'] = page context['page_range'] = calculate_page_range_from_page_info( page) context['data'] = service_list context['service_groups'] = service_groups context['permissions'] = permissions context['is_show_export'] = check_permissions_by_user( self.request.user, 'CAN_EXPORT_SERVICE') return render(request, self.template_name, context)
def post(self, request, *args, **kwargs): self.logger.info('========== Start {} bank SOF =========='.format( "downloading" if 'download' in request.POST else "searching")) user_id = request.POST.get('user_id') user_type_id = request.POST.get('user_type_id') currency = request.POST.get('currency') created_from_date = request.POST.get('created_from_date') created_to_date = request.POST.get('created_to_date') created_from_time = request.POST.get('created_from_time') created_to_time = request.POST.get('created_to_time') opening_page_index = request.POST.get('current_page_index') body = {'paging': True, 'page_index': int(opening_page_index)} if user_id is not '' and user_id is not None: body['user_id'] = user_id if user_type_id is not '' and user_type_id is not '0' and user_type_id is not None: body['user_type_id'] = int( 0 if user_type_id is None else user_type_id) if currency is not '' and currency is not None: body['currency'] = currency if created_from_date: body['from_created_timestamp'] = convert_string_to_date_time( created_from_date, created_from_time) if created_to_date: body['to_created_timestamp'] = convert_string_to_date_time( created_to_date, created_to_time) context = {} if 'download' in request.POST: file_type = request.POST.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file( self, body=body, url_download=api_settings.BANK_SOFS_URL, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info( '========== Finish exporting bank SOF ==========') return response else: data, success, status_message = self._get_bank_sof_list(body=body) context.update({ 'created_from_date': created_from_date, 'created_to_date': created_to_date, 'created_from_time': created_from_time, 'created_to_time': created_to_time, 'search_by': body }) if success: cards_list = data.get("bank_sofs", []) page = data.get("page", {}) self.logger.info("Page: {}".format(page)) context.update({ 'search_count': page.get('total_elements', 0), 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'bank_sof_list': cards_list, 'is_show_export': check_permissions_by_user( self.request.user, 'CAN_EXPORT_BANK_SOF_INFORMATION') }) else: context.update({ 'search_count': 0, 'paginator': {}, 'bank_sof_list': [], 'is_show_export': False }) self.logger.info('========== End searching bank SOF ==========') return render(request, self.template_name, context)
def post(self, request, *args, **kwargs): order_id = request.POST.get('order_id') searched_services = request.POST.getlist('service_name') user_id = request.POST.get('user_id') user_type_id = request.POST.get('user_type') from_created_timestamp = request.POST.get('from_created_timestamp') to_created_timestamp = request.POST.get('to_created_timestamp') ext_transaction_id = request.POST.get('ext_transaction_id') list_status_id = request.POST.getlist('list_status_id') product_name = request.POST.get('product_name') product_ref = request.POST.get('product_ref') creation_client_id = request.POST.get('creation_client_id') execution_client_id = request.POST.get('execution_client_id') opening_page_index = request.POST.get('current_page_index') error_code = request.POST.getlist('error_code_id') ref_order_id = request.POST.get('ref_order_id') creation_channel_type = request.POST.get('creation_channel_type') creation_device_unique_reference = request.POST.get('creation_device_unique_reference') error_code_search = error_code if 'All' in error_code: error_code_search = ["insufficient_fund", "security_code_expired","security_code_failed","invalid_request", "payment_not_allow", "cancel_order_not_allow", "general_error"] error_code = ["All"] list_status_search = [] for status in list_status_id: list_status_search.append(int(status)) list_status_id = list(list_status_search) body = {} if order_id: body['order_id'] = order_id if ref_order_id: body['ref_order_id'] = ref_order_id if user_id and user_id.isdigit(): body['user_id'] = int(user_id) elif user_id: body['user_id'] = user_id if user_type_id.isdigit() and user_type_id != '0': body['user_type_id'] = int(user_type_id) if ext_transaction_id: body['ext_transaction_id'] = ext_transaction_id if list_status_search: body['status_id_list'] = list_status_search if product_name: body['product_name'] = product_name if product_ref: body['product_ref'] = product_ref if creation_client_id: body['created_client_id'] = creation_client_id if execution_client_id: body['executed_client_id'] = execution_client_id if error_code_search: body['error_codes'] = error_code_search if searched_services: searched_services = [int(i) for i in searched_services if i.isnumeric()] body['service_id_list'] = searched_services if creation_channel_type: body['created_channel_type'] = creation_channel_type if creation_device_unique_reference: body['created_device_unique_reference'] = creation_device_unique_reference if from_created_timestamp is not '' and to_created_timestamp is not None: new_from_created_timestamp = datetime.strptime(from_created_timestamp, "%Y-%m-%d") new_from_created_timestamp = new_from_created_timestamp.strftime('%Y-%m-%dT%H:%M:%SZ') body['from'] = new_from_created_timestamp if to_created_timestamp is not '' and to_created_timestamp is not None: new_to_created_timestamp = datetime.strptime(to_created_timestamp, "%Y-%m-%d") new_to_created_timestamp = new_to_created_timestamp.replace(hour=23, minute=59, second=59) new_to_created_timestamp = new_to_created_timestamp.strftime('%Y-%m-%dT%H:%M:%SZ') body['to'] = new_to_created_timestamp if 'download' in request.POST: self.logger.info('========== Start exporting payment order ==========') file_type = request.POST.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file(self, body=body, url_download=PAYMENT_URL, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info('========== Finish exporting payment order ==========') return response if 'search' in request.POST: self.logger.info('========== Start getting service list ==========') services = self.get_services_list() services.sort(key=lambda service: service['service_name']) self.logger.info('========== Finish getting service list ==========') self.logger.info('========== Start searching payment order ==========') body['paging'] = True body['page_index'] = int(opening_page_index) data, is_success = self.get_payment_order_list(body=body) if data: result_data = self.format_data(data) else: result_data = data order_list = self.refine_data(result_data) orders = order_list.get("orders", []) page = order_list.get("page", {}) self.logger.info('Page : {}'.format(page)) count = 0 if len(order_list): count = len(order_list) context = {'order_list': orders, 'order_id': order_id, 'ref_order_id': ref_order_id, 'searched_services': searched_services, 'services': services, 'user_type':user_type_id, 'user_id': user_id, 'search_count': page.get('total_elements', 0), 'product_name': product_name, 'product_ref': product_ref, 'creation_client_id': creation_client_id, 'execution_client_id': execution_client_id, 'ext_transaction_id': ext_transaction_id, 'status_list': status_list, 'error_list': error_list, 'date_from': from_created_timestamp, 'date_to': to_created_timestamp, 'permissions': self._get_has_permissions(), 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'creation_channel_type': creation_channel_type, 'creation_device_unique_reference': creation_device_unique_reference, } if is_success: context['is_show_export'] = True else: context['is_show_export'] = False if list_status_id: context['status_code_id'] = list_status_id if error_code: context['error_code_id'] = error_code self.logger.info('========== Finished searching payment order ==========') return render(request, self.template_name, context)
def post(self, request, *args, **kwargs): self.logger.info('========== Start {} card SOF =========='.format('download' if 'download' in request.POST else 'search')) user_id = request.POST.get('user_id') user_type_id = request.POST.get('user_type_id') currency = request.POST.get('currency') from_created_timestamp = request.POST.get('from_created_timestamp') to_created_timestamp = request.POST.get('to_created_timestamp') from_created_time = request.POST.get('from_created_time') to_created_time = request.POST.get('to_created_time') opening_page_index = request.POST.get('current_page_index') body = {'paging': True, 'page_index': int(opening_page_index)} if user_id is not '' and user_id is not None: body['user_id'] = user_id if user_type_id is not '' and user_type_id is not '0' and user_type_id is not None: body['user_type_id'] = int(0 if user_type_id is None else user_type_id) if currency is not '' and currency is not None: body['currency'] = currency if from_created_timestamp: body['from_created_timestamp'] = convert_string_to_date_time(from_created_timestamp, from_created_time) if to_created_timestamp: body['to_created_timestamp'] = convert_string_to_date_time(to_created_timestamp, to_created_time) context = {} if 'download' in request.POST: file_type = request.POST.get('export-type') body['file_type'] = file_type body['row_number'] = 5000 is_success, data = export_file(self, body=body, url_download=CARD_SOFS_URL, api_logger=API_Logger) if is_success: response = make_download_file(data, file_type) self.logger.info('========== End export card source of fund ==========') return response else: data, success, status_message = self._get_card_sof_list(body=body) body['from_created_timestamp'] = from_created_timestamp body['to_created_timestamp'] = to_created_timestamp if success: cards_list = data.get("card_sofs", []) page = data.get("page", {}) self.logger.info("Page: {}".format(page)) context.update({ 'search_by.user_id': user_id, 'search_by.currency': currency, 'search_by.user_type_id': user_type_id, 'search_by.from_created_timestamp': from_created_timestamp, 'from_created_time': from_created_time, 'search_by.to_created_timestamp': to_created_timestamp, 'to_created_time': to_created_time, 'search_count': page.get('total_elements', 0), 'paginator': page, 'page_range': calculate_page_range_from_page_info(page), 'card_sof_list': cards_list, 'search_by': body, 'is_show_export': check_permissions_by_user(self.request.user,"CAN_EXPORT_CARD_SOF_INFORMATION") }) else: context.update({ 'search_count': 0, 'paginator': {}, 'card_sof_list': [], 'search_by': body, 'is_show_export': False }) self.logger.info('========== End search card SOF ==========') return render(request, self.template_name, context)