def delete_student():
    form = DeleteForm()
    if request.method == 'POST' and form.validate():
        student = Students(idNum=form.id_number.data)
        if student.exist():
            student.delete()
            flash("Deleted student with id number '{}'".format(
                form.id_number.data), category='success')
            return redirect(url_for('students'))
        else:
            flash("Student Does not exist.", category='danger')
            return redirect(url_for('delete_student'))
    else:
        return render_template('delete_student.html', form=form)
def delete(student_id):
    student = Students(idNum=student_id)
    student.delete()
    flash(f"Deleted student with id number '{student_id}'", category='success')
    return redirect(url_for('students'))