Пример #1
0
def edit():
    card = request.vars["address"]

    form = BOOTUPFORM(db.card, card)
    if form.process(onvalidation=computedate).accepted:
        redirect(URL("card", "index"))
    return dict(form=form)
Пример #2
0
def edit():
    reward = request.vars['reward']

    form = BOOTUPFORM(db.reward, record=reward.reward)
    if ( form.process().accepted):
        redirect(URL('reward', 'view', args=[reward.reward.projectid]))
    return dict(form=form, projectid=reward.reward.projectid)
Пример #3
0
def edit():
    user = db(db.user.iduser == auth.user_id).select(db.user.ALL).first()
    form = BOOTUPFORM(db.user, user)

    if form.process(onvalidation=computebirthdate).accepted:
        redirect(URL('user', 'index'))
    return dict(form=form)
Пример #4
0
def edit():
    address = request.vars['address']

    form = BOOTUPFORM(db.address, address)

    if form.process().accepted:
        redirect(URL('address', 'index'))

    return dict(form=form)
Пример #5
0
def edit():
    project = request.vars['project']

    form = BOOTUPFORM(db.project, project.project, upload=URL(img))
    message = ""
    if form.process().accepted:
        redirect(URL('project', 'view', args=[project.project.idproject]))

    return dict(form=form, message=message, projectid=project.project.idproject)
Пример #6
0
def edit():
    pledge = request.vars['pledge']

    record = pledge.pledge
    record.rewards = pledge.pledge.rewardids()

    form = BOOTUPFORM.factory(db.pledge,
                              Field('rewards', requires=IS_IN_DB(db(db.reward.projectid == pledge.pledge.projectid),
                                                                 db.reward.idreward, '%(description)s',
                                                                 multiple=[1, 9999],
                                                                 error_message="Please select at least one reward")),
                              record=record)
    """
    As we're have to remove the rewardpledges ourselves, the simplest action is to delete all reward pledges
    then create a new set of rewardpledges for the items that the user has chosen in the form
    """
    if ( form.process().accepted):
        for reward in pledge.pledge.rewardids():
            db((db.rewardpledge.pledgeid == int(pledge.pledge.idpledge)) & (
                db.rewardpledge.rewardid == int(reward))).select(db.rewardpledge.ALL).first().rawdelete()

        for reward in form.vars.rewards:
            reward = int(reward)
            dbreward = db(db.reward.idreward == reward).select(db.reward.ALL).first()
            if int(dbreward.projectid) is int(pledge.pledge.projectid):
                db.rewardpledge.insert(rewardid=reward, pledgeid=pledge.pledge.idpledge)

        db(db.pledge.idpledge == pledge.pledge.idpledge).update(description=form.vars.description,
                                                                value=form.vars.value)

        redirect(URL('pledge', 'view', args=[pledge.pledge.projectid]))
    return dict(form=form, projectid=pledge.pledge.projectid)
Пример #7
0
def create():
    project = request.vars['project'].project

    form = BOOTUPFORM.factory(db.reward)
    if ( form.process().accepted):
        db.reward.insert(description=form.vars.description, projectid=project.idproject)
        redirect(URL('reward', 'view', args=[project.idproject]))
    return dict(project=project, form=form, projectid=project.idproject)
Пример #8
0
def close():
    project = request.vars['project']

    form = BOOTUPFORM.confirm('Close', 'btn-warning', {'Back': URL('user', 'projects')})
    if form.accepted:
        db.closedproject.insert(openprojectid=project.project.idproject)
        redirect(URL('user', 'projects'))

    return dict(record=project, form=form)
Пример #9
0
def delete():
    card = request.vars["card"]

    form = BOOTUPFORM.confirm("Delete", "btn-danger", {"Back": URL("card", "index")})
    if form.accepted:
        db(db.card.idcard == card.idcard).delete()

        redirect(URL("card", "index"))
    return dict(form=form)
Пример #10
0
def delete():
    pledge = request.vars['pledge']

    form = BOOTUPFORM.confirm('Delete', 'btn-danger', {'Back': URL('pledge', 'view', args=[pledge.project.idproject])})
    if form.accepted:
        db(db.pledege.idpledge == pledge.pledge.idpledge).delete()
        redirect(URL('pledge', 'view', args=[pledge.pledge.idpledge]))

    return dict(form=form)
Пример #11
0
def delete():
    address = request.vars['address']

    form = BOOTUPFORM.confirm('Delete', 'btn-danger', {'Back': URL('card', 'index')})
    if form.accepted:
        db(db.address.idaddress == address.idaddress).delete()
        redirect(URL('address', 'index'))

    return dict(form=form)
Пример #12
0
def delete():
    project = request.vars['project']
    form = BOOTUPFORM.confirm('Delete', 'btn-danger', {'Back': URL('user', 'projects')})

    if form.accepted:
        project.project.rawdelete()
        redirect(URL('user', 'projects'))

    return dict(project=project, form=form)
Пример #13
0
def make():
    pledge = request.vars['pledge']

    form = BOOTUPFORM.factory(db.booting)
    if form.process().accepted:
        db.booting.insert(openprojectid=pledge.project.idproject, pledgeid=pledge.pledge.idpledge,
                          addressid=form.vars.addressid,
                          cardid=form.vars.cardid, bootingdate=request.now, userid=auth.user_id)
        redirect(URL('project', 'view', args=[pledge.project.idproject]))

    return dict(pledge=pledge, form=form)
Пример #14
0
def delete():
    reward = request.vars['reward']

    form = BOOTUPFORM.confirm('Delete', 'btn-danger', {'Back': URL('pledge', 'view', args=[reward.project.idproject])})

    projectid = reward.reward.projectid

    if form.accepted:
        reward.reward.rawdelete()
        redirect(URL('reward', 'view', args=[projectid]))

    return dict(form=form, projectid=projectid)
Пример #15
0
def open():
    project = request.vars['project']

    form = BOOTUPFORM.confirm('Open', 'btn-primary', {'Back': URL('user', 'projects')})
    if form.accepted:
        # If the project has previously been opened, we delete the projectclosed record, otherwise create an openproject
        #record
        if db(db.openproject.projectid == project.project.idproject).count() > 0:
            db(db.closedproject.openprojectid == project.project.idproject).delete()
        else:
            db.openproject.insert(projectid=project.project.idproject)

        redirect(URL('project', 'view', args=[project.project.idproject]))

    return dict(project=project, form=form)
Пример #16
0
def create():
    project = request.vars['project'].project

    form = BOOTUPFORM.factory(db.pledge,
                              Field('rewards', requires=IS_IN_DB(db(db.reward.projectid == project.idproject),
                                                                 db.reward.idreward, '%(description)s',
                                                                 multiple=[1, 9999],
                                                                 error_message="Please select at least one reward")))

    if ( form.process().accepted):
        pledgeid = db.pledge.insert(idpledge=None, description=form.vars.description, value=form.vars.value,
                                    projectid=project.idproject)

        """
        For each reward that was selected in the form, if the reward project matches ours, create a rewardpledge
        """
        for reward in form.vars.rewards:
            reward = int(reward)
            dbreward = db(db.reward.idreward == reward).select(db.reward.ALL).first()
            if int(dbreward.projectid) is int(project.idproject):
                db.rewardpledge.insert(rewardid=reward, pledgeid=pledgeid)

        redirect(URL('pledge', 'view', args=[project.idproject]))
    return dict(project=project, form=form, projectid=project.idproject)
Пример #17
0
def create():
    form = BOOTUPFORM(db.address)
    if form.process().accepted:
        redirect(URL('address', 'index'))

    return dict(form=form)
Пример #18
0
def create():
    form = BOOTUPFORM(db.project)
    message = ""
    if form.process().accepted:
        redirect(URL('user', 'projects'))
    return dict(form=form, message=message)