def list(): import pwdmanager users = pwdmanager.get_user_list() # trying to be smart and sorting by last name users = sorted(users, key=lambda x: x[1].split(" ")[-1].lower()) bread = base_bread() return render_template("user-list.html", title="All Users", users=users, bread=bread)
def list(): import pwdmanager COLS = 5 users = pwdmanager.get_user_list() # attempt to sort by last name users = sorted(users, key=lambda x: x[1].strip().split(" ")[-1].lower()) if len(users)%COLS: users += [{} for i in range(COLS-len(users)%COLS)] n = len(users)/COLS user_rows = zip(*[users[i*n:(i+1)*n] for i in range(COLS)]) bread = base_bread() return render_template("user-list.html", title="All Users", user_rows=user_rows, bread=bread)