def proposals(status, page, cat): if not isinstance(status, int) and not isinstance(page, int) and not cat: # no args, render overview proposals = { 'proposed': Proposal.find_by_args(status=1, limit=10), 'funding': Proposal.find_by_args(status=2, limit=10), 'wip': Proposal.find_by_args(status=3, limit=10), 'completed': Proposal.find_by_args(status=4, limit=10)} return make_response(render_template('proposal/overview.html', proposals=proposals)) try: if not isinstance(status, int): status = 1 proposals = Proposal.find_by_args(status=status, cat=cat) except: return make_response(redirect(url_for('proposals'))) return make_response(render_template('proposal/proposals.html', proposals=proposals, status=status, cat=cat))
def api_proposals_get(status, cat, limit, offset): try: proposals = Proposal.find_by_args(status=status, cat=cat, limit=limit, offset=offset) except Exception as ex: print(ex) return 'error', 500 return [p.json for p in proposals]