search boats only if len(name) > 2
This commit is contained in:
parent
951a325293
commit
2729011946
@ -21,8 +21,9 @@ def new_stay(request):
|
||||
|
||||
name = request.POST.get('search_name', '')
|
||||
boat_existing = [ (b.id, b.name) for b in \
|
||||
Boat.objects.filter(name__icontains=name) ]
|
||||
pprint(boat_existing)
|
||||
Boat.objects.filter(name__icontains=name) ] \
|
||||
if len(name) > 2 else []
|
||||
|
||||
boat_search_form = BoatSearchForm(
|
||||
name=name,
|
||||
choices=boat_existing)
|
||||
|
Loading…
Reference in New Issue
Block a user