Added find_farm command
parent
2816d528a0
commit
217b55ec02
|
@ -382,7 +382,12 @@ def find_farm(resource_name):
|
||||||
if len(resource_name) == 0:
|
if len(resource_name) == 0:
|
||||||
raise EmptryString
|
raise EmptryString
|
||||||
|
|
||||||
return objects_list_to_json(PublicFarm.objects.filter(resource__resource_name__icontains=resource_name).all())
|
farms = PublicFarm.objects.filter(resource__resource_name__icontains=resource_name).all()[:10]
|
||||||
|
|
||||||
|
if len(farms) == 0:
|
||||||
|
raise ResourceNotFoundError
|
||||||
|
|
||||||
|
return objects_list_to_json(farms)
|
||||||
|
|
||||||
|
|
||||||
@command("GET")
|
@command("GET")
|
||||||
|
|
Loading…
Reference in New Issue