示例#1
0
文件: ui.py 项目: ryanlerch/nuancier
def results_list():
    ''' Displays the results of all published election. '''
    elections = nuancierlib.get_elections_public(SESSION)

    return flask.render_template(
        'result_list.html',
        elections=elections)
    def test_get_elections_public(self):
        """ Test the get_elections_public function. """
        create_elections(self.session)

        elections = nuancierlib.get_elections_public(self.session)
        self.assertEqual(1, len(elections))
        self.assertEqual('Wallpaper F19', elections[0].election_name)
示例#3
0
    def test_get_elections_public(self):
        """ Test the get_elections_public function. """
        create_elections(self.session)

        elections = nuancierlib.get_elections_public(self.session)
        self.assertEqual(1, len(elections))
        self.assertEqual('Wallpaper F19', elections[0].election_name)
示例#4
0
def index():
    ''' Display the index page. '''
    elections = nuancierlib.get_elections_open(SESSION)
    contributions = nuancierlib.get_elections_to_contribute(SESSION)
    published = nuancierlib.get_elections_public(SESSION)
    election = election_results = None
    if published:
        election = published[0]
        election_results = nuancierlib.get_results(SESSION, election.id)
    return flask.render_template('index.html',
                                 elections=elections,
                                 election=election,
                                 results=election_results,
                                 contributions=contributions)
示例#5
0
文件: ui.py 项目: ryanlerch/nuancier
def index():
    ''' Display the index page. '''
    elections = nuancierlib.get_elections_open(SESSION)
    contributions = nuancierlib.get_elections_to_contribute(SESSION)
    published = nuancierlib.get_elections_public(SESSION)
    election = election_results = None
    if published:
        election = published[0]
        election_results = nuancierlib.get_results(SESSION, election.id)
    return flask.render_template(
        'index.html',
        elections=elections,
        election=election,
        results=election_results,
        contributions=contributions)
示例#6
0
def results_list():
    ''' Displays the results of all published election. '''
    elections = nuancierlib.get_elections_public(SESSION)

    return flask.render_template('result_list.html', elections=elections)