Exemplo n.º 1
0
def get_priorities(page=1):
    priorities = FlicketPriority.query
    per_page = min(
        request.args.get('per_page', app.config['posts_per_page'], type=int),
        100)
    data = FlicketPriority.to_collection_dict(priorities, page, per_page,
                                              'bp_api.get_priorities')
    return jsonify(data)
Exemplo n.º 2
0
    def create_default_priority_levels(silent=False):
        """ set up default priority levels """

        pl = ['low', 'medium', 'high']
        for p in pl:
            priority = FlicketPriority.query.filter_by(priority=p).first()

            if not priority:
                add_priority = FlicketPriority(priority=p)
                db.session.add(add_priority)

                if not silent:
                    print('Added priority level {}'.format(p))