def fighters_index():
    filterform=FilterForm()
    filterform.by_club.choices=Fighter.get_clubs()
    belt_filter= dict(filterform.by_belt.choices).get(filterform.by_belt.data)
    club_filter= dict(filterform.by_club.choices).get(filterform.by_club.data)

    return render_template("fighters/list.html", fighters= Fighter.query.all(), searchform=SearchForm(), filterform=filterform)
Exemple #2
0
def matches_index():
    filterform=FilterForm()
    filterform.by_club.choices=clubs=Fighter.get_clubs()
    matches= Match.query.order_by(Match.date.desc()).all()
    to_list=form_matchlist(matches)
    
    return render_template("matches/list.html", matches = to_list, searchform=SearchForm(), filterform=filterform)
Exemple #3
0
def fighters_index():
    filterform = FilterForm()
    filterform.by_club.choices = Fighter.get_clubs()

    return render_template("fighters/list.html",
                           fighters=Fighter.query.order_by(Fighter.name).all(),
                           searchform=SearchForm(),
                           filterform=filterform)
def fighters_search():
    filterform=FilterForm()
    filterform.by_club.choices=clubs=Fighter.get_clubs()

    search_by =request.args.get('searchword')

    if len(search_by)==0:
        return redirect(url_for("fighters_index"))

    qry = db.session().query(Fighter).filter(
                Fighter.name.contains(search_by))
    results= qry.all()

    return render_template("fighters/list.html", fighters= results, searchform=SearchForm(),
                    filterform=filterform)
def fighters_filter():
    
    filterform=FilterForm(request.form)
    clubs=Fighter.get_clubs()
    filterform.by_club.choices=clubs

    belt = request.args.get('by_belt')
    club = request.args.get('by_club')


    if (belt != '-1' or club != '-1'):
        fighters=Fighter.filter_fighters(belt, club, clubs)
        return render_template("fighters/list.html", fighters=fighters, searchform=SearchForm(),
                    filterform=filterform)
    else:
       return redirect(url_for("fighters_index")) 
Exemple #6
0
def matches_filter():
    
    filterform=FilterForm(request.form)
    clubs=Fighter.get_clubs()
    filterform.by_club.choices=clubs

    belt = request.args.get('by_belt')
    club = request.args.get('by_club')
    winning_category= request.args.get('by_winning_category')


    if (belt != '-1' or club != '-1' or winning_category != '-1'):
        matches =Match.filter_matches(belt, club, clubs, winning_category)
        to_list=form_matchlist(matches)
        return render_template("matches/list.html", matches=to_list, searchform=SearchForm(),
                    filterform=filterform)
    else:
       return redirect(url_for("matches_index"))
Exemple #7
0
def matches_search():
    filterform=FilterForm()
    filterform.by_club.choices=clubs=Fighter.get_clubs()

    search_by =request.args.get('searchword')

    if len(search_by)==0:
        return redirect(url_for("matches_index"))

    qry = db.session().query(Fighter).filter(
                Fighter.name.contains(search_by))
    fighters= qry.all()

    if len(fighters)==0:
      to_list=[]
    else:
      matches = Match.get_matches_by_fighter(fighters)
      to_list=form_matchlist(matches)

    return render_template("matches/list.html", matches = to_list, searchform=SearchForm(), filterform=filterform)