print报错

This commit is contained in:
caoqianming 2021-07-21 14:54:43 +08:00
parent e11447b800
commit e99cab6d03
1 changed files with 0 additions and 3 deletions

View File

@ -59,15 +59,12 @@ class CMAViewSet(RecordMixin, ModelViewSet):
"""
queryset = self.filter_queryset(self.get_queryset())
ret = []
ret2 = {}
if request.query_params.get('group_by', None):
group_by = request.query_params.get('group_by')
group_by_data = list(queryset.values(group_by).annotate(count=Count(group_by)).order_by(group_by))
for i in group_by_data:
if i[group_by] and i['count']:
ret2[i[group_by]] = "A"
ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
print(ret2)
return Response(ret)
@action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
def deletes(self, request):