mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 10:58:58 -04:00
Require data on search by name form
This lets us build leaner views when using this form.
This commit is contained in:
@@ -1127,7 +1127,10 @@ class RequiredDateFilterForm(StripWhitespaceForm):
|
||||
|
||||
class SearchByNameForm(StripWhitespaceForm):
|
||||
|
||||
search = SearchField('Search by name')
|
||||
search = SearchField(
|
||||
'Search by name',
|
||||
validators=[DataRequired("You need to enter full or partial name to search by.")],
|
||||
)
|
||||
|
||||
|
||||
class SearchUsersByEmailForm(StripWhitespaceForm):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from flask import render_template, request
|
||||
from flask import render_template
|
||||
|
||||
from app import service_api_client
|
||||
from app.main import main
|
||||
@@ -11,13 +11,10 @@ from app.utils import user_is_platform_admin
|
||||
def find_services_by_name():
|
||||
form = SearchByNameForm()
|
||||
services_found = None
|
||||
status = 200
|
||||
if form.validate_on_submit():
|
||||
services_found = service_api_client.find_services_by_name(service_name=form.search.data)['data']
|
||||
elif request.method == 'POST':
|
||||
status = 400
|
||||
return render_template(
|
||||
'views/find-services/find-services-by-name.html',
|
||||
form=form,
|
||||
services_found=services_found
|
||||
), status
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user