Example #1
0
def edit_contact(cid='new'):
    if cid != 'new':
        cid = objId(cid)
    return {
        'entry' : entries.find_one({'_id': cid}),
        'settings' : settings
        }
Example #2
0
def save_contact():
    contact = {}
    for k,v in request.forms.iterallitems():
        if (k,v) != ('_id', 'new'):
            contact[k] = v
        if '_id' in contact:
            contact['_id'] = objId(contact['_id'])
    entries.save(contact)
    redirect('/')