|
@@ -1141,14 +1141,20 @@ class UserManagement(View):
|
|
|
paginator = Paginator(custom_customer_qs.order_by('id'), page_size)
|
|
|
customers = paginator.page(page)
|
|
|
|
|
|
+ # 批量查询所有相关的国家信息
|
|
|
+ country_ids = custom_customer_qs.values_list('country_id', flat=True).distinct()
|
|
|
+ country_qs = CountryModel.objects.filter(id__in=country_ids)
|
|
|
+ country_map = {country.id: country.country_name for country in country_qs}
|
|
|
+
|
|
|
customer_list = []
|
|
|
for customer in customers.object_list:
|
|
|
+ country_name = country_map.get(customer.country_id, '')
|
|
|
customer_list.append({
|
|
|
'cId': customer.id,
|
|
|
'orderNumber': customer.order_number,
|
|
|
'name': customer.name,
|
|
|
'email': customer.email,
|
|
|
- 'countryId': customer.country_id,
|
|
|
+ 'countryName': country_name,
|
|
|
'quantity': customer.quantity,
|
|
|
'createdTime': customer.created_time,
|
|
|
})
|