Fix zone filter if no zone is specified in params
This commit is contained in:
parent
fe84079885
commit
73e7fe88f8
1 changed files with 6 additions and 2 deletions
|
@ -38,8 +38,12 @@ def soil_variant_filter(request, queryset):
|
||||||
|
|
||||||
def zone_filter(request, queryset):
|
def zone_filter(request, queryset):
|
||||||
zone = request.query_params.get('zone')
|
zone = request.query_params.get('zone')
|
||||||
zone_json = json.loads(zone)
|
|
||||||
return queryset.filter(zones__id__contains=zone_json['id']).distinct()
|
if zone != None:
|
||||||
|
zone_json = json.loads(zone)
|
||||||
|
return queryset.filter(zones__id__contains=zone_json['id']).distinct()
|
||||||
|
|
||||||
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
def soil_order_coordinate_filter(coordinates):
|
def soil_order_coordinate_filter(coordinates):
|
||||||
|
|
Loading…
Reference in a new issue