Commit 08f03226 authored by lvshibao's avatar lvshibao

获取team修改

parent 38721264
from django.db.models import Q
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.request import Request
......@@ -93,7 +94,9 @@ class AgencyApi(viewsets.ViewSet):
if top.parent is None:
pass
elif country_id is None or country_id == '':
team_list = Team.objects.filter(country_id=city_id).values('id', 'name')
country_ids = Country.objects.filter(parent=city_id).values_list('id', flat=True)
team_list = Team.objects.filter(Q(country_id=city_id) | Q(country_id__in=country_ids)).values('id',
'name')
else:
team_list = Team.objects.filter(country_id=country_id).values('id', 'name')
return Response({'code': 0, 'msg': 'success', 'data': {'team_list': team_list}})
......
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