Commit 9a488f79 authored by lvshibao's avatar lvshibao

获取市县的接口的修改

parent 9ada3a7c
...@@ -76,7 +76,7 @@ class AgencyApi(viewsets.ViewSet): ...@@ -76,7 +76,7 @@ class AgencyApi(viewsets.ViewSet):
top = Country.objects.filter(id=city_id).first() top = Country.objects.filter(id=city_id).first()
if top is not None: if top is not None:
if top.parent is None: if top.parent is None:
countries = Country.objects.filter().all() countries = Country.objects.exclude(parent=top.id).filter(parent__isnull=False).all()
for country in countries: for country in countries:
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})
......
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