print报错
This commit is contained in:
parent
e11447b800
commit
e99cab6d03
|
|
@ -59,15 +59,12 @@ class CMAViewSet(RecordMixin, ModelViewSet):
|
||||||
"""
|
"""
|
||||||
queryset = self.filter_queryset(self.get_queryset())
|
queryset = self.filter_queryset(self.get_queryset())
|
||||||
ret = []
|
ret = []
|
||||||
ret2 = {}
|
|
||||||
if request.query_params.get('group_by', None):
|
if request.query_params.get('group_by', None):
|
||||||
group_by = request.query_params.get('group_by')
|
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))
|
group_by_data = list(queryset.values(group_by).annotate(count=Count(group_by)).order_by(group_by))
|
||||||
for i in group_by_data:
|
for i in group_by_data:
|
||||||
if i[group_by] and i['count']:
|
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]})
|
ret.append({'text':i[group_by]+'('+ str(i['count']) +')','value':i[group_by]})
|
||||||
print(ret2)
|
|
||||||
return Response(ret)
|
return Response(ret)
|
||||||
@action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
|
@action(methods=['post'], detail=False, url_path='deletes', url_name='cma_deletes', perms_map = {'post':'cma_deletes'})
|
||||||
def deletes(self, request):
|
def deletes(self, request):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue