Commit 8f44c252 authored by lvshibao's avatar lvshibao

group页面修改

parent e8c78f8a
...@@ -47,14 +47,10 @@ class AgencyApi(viewsets.ViewSet): ...@@ -47,14 +47,10 @@ class AgencyApi(viewsets.ViewSet):
city_list.append({'id': top.id, 'name': top.name}) city_list.append({'id': top.id, 'name': top.name})
countries = Country.objects.filter(parent=top.id).all() countries = Country.objects.filter(parent=top.id).all()
country_id_list = list()
if len(countries) > 0: if len(countries) > 0:
for country in countries: for country in countries:
print(country.name)
if len(Team.objects.filter(country=country.id).all()) > 0: if len(Team.objects.filter(country=country.id).all()) > 0:
country_list.append({'id': country.id, 'name': country.name}) country_list.append({'id': country.id, 'name': country.name})
country_id_list.append(country.id)
return_data = {'city_list': city_list, 'country_list': country_list, 'city_id': city_id} return_data = {'city_list': city_list, 'country_list': country_list, 'city_id': city_id}
...@@ -76,7 +72,8 @@ class AgencyApi(viewsets.ViewSet): ...@@ -76,7 +72,8 @@ class AgencyApi(viewsets.ViewSet):
else: else:
countries = Country.objects.filter(parent=city_id).all() countries = Country.objects.filter(parent=city_id).all()
for country in countries: for country in countries:
country_list.append({'id': country.id, 'name': country.name}) if len(Team.objects.filter(country=country.id).all()) > 0:
country_list.append({'id': country.id, 'name': country.name})
return Response({'code': 0, 'msg': 'success', 'data': {'country_list': country_list}}) return Response({'code': 0, 'msg': 'success', 'data': {'country_list': country_list}})
else: else:
return Response({'code': -1, 'msg': '未找到对应的县市'}) return Response({'code': -1, 'msg': '未找到对应的县市'})
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