def add(uid, group, description, amount, creditor, debtors):
    date = dateutils.totuple(dateutils.now())
    
    members = set(x[0] for x in user.getmembers(uid))

    if not creditor in members:
        raise PermissionError()

    for debtor in debtors:
        if not debtor[0] in members:
            raise PermissionError()

    db().save_doc({
        "type": "entry",
        "amount": amount,
        "creditor": creditor,
        "date": date,
        "debtors": debtors,
        "description": description,
        "group": group,
        "uid": uid,
        "deletedby":None,
    })
def new_form():
    members = list(user.getmembers(local.session.get("uid")))
    template_response("/page/entries/new.mako",
        members=members
    )