Example #1
0
    def by_name(self, input,*args,**kw):
        input = input.lower()
        if 'anywhere' in kw:
            search = Group.list_by_name(input, find_anywhere=True)
        else:
            search = Group.list_by_name(input)

        groups =  [match.group_name for match in search]
        return dict(matches=groups)
Example #2
0
    def by_name(self, input, *args, **kw):
        input = input.lower()
        if 'anywhere' in kw:
            search = Group.list_by_name(input, find_anywhere=True)
        else:
            search = Group.list_by_name(input)

        groups = [match.group_name for match in search]
        return dict(matches=groups)
Example #3
0
def groups_typeahead():
    if 'q' in request.args:
        groups = Group.list_by_name(request.args['q'], find_anywhere=False)
    else:
        groups = Group.query
    data = [{'group_name': group.group_name, 'display_name': group.display_name,
             'tokens': [group.group_name]}
            for group in groups.values(Group.group_name, Group.display_name)]
    return jsonify(data=data)
Example #4
0
def groups_typeahead():
    if 'q' in request.args:
        groups = Group.list_by_name(request.args['q'], find_anywhere=False)
    else:
        groups = Group.query
    data = [{'group_name': group.group_name, 'display_name': group.display_name,
             'tokens': [group.group_name]}
            for group in groups.values(Group.group_name, Group.display_name)]
    return jsonify(data=data)