def students(): form = SearchForm() if request.method == 'POST' and form.validate(): filteredStudents = Students.search(form.choice.data, form.search.data) students = filteredStudents if filteredStudents is False: flash('Search Error! "{}" does not exist on our list or you have the wrong category'.format( form.search.data), category='danger') return redirect(url_for('students')) return render_template('display_students.html', form=form, filtered=students, students="") else: students = Students.all() return render_template('display_students.html', form=form, students=students, filtered="")
def students(): form = SearchForm() if request.method == 'POST' and form.validate(): filteredStudents = Students.search(form.choice.data, form.search.data) students = filteredStudents return render_template('display_students.html', form=form, filtered=students, students="") else: students = Students.all() return render_template('display_students.html', form=form, students=students, filtered="")