Added find_farm command

doc_update
Joey Hines 2019-05-14 17:38:12 -05:00
parent 2816d528a0
commit 217b55ec02
1 changed files with 6 additions and 1 deletions

View File

@ -382,7 +382,12 @@ def find_farm(resource_name):
if len(resource_name) == 0:
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")