예제 #1
0
def create_new_stage(stage_data):
    '''Create a new stage.

    Creates a new stage from the passed stage_data
    and returns the created stage object.
    '''
    properties = stage_data.pop('properties', [])
    stage = Stage.create(**stage_data)
    for property in properties:
        property.update({'stage_id': stage.id})
        StageProperty.create(**property)

    return stage
예제 #2
0
def create_new_stage(stage_data):
    '''Create a new stage.

    Creates a new stage from the passed stage_data
    and returns the created stage object.
    '''
    properties = stage_data.pop('properties', [])
    stage = Stage.create(**stage_data)
    for property in properties:
        property.update({'stage_id': stage.id})
        StageProperty.create(**property)

    return stage
예제 #3
0
def insert_a_stage(name='foo', send_notifs=False, post_opportunities=False):
    stage = Stage.create(**{
        'name': name, 'send_notifs': send_notifs,
        'post_opportunities': post_opportunities
    })

    properties = [
        dict(stage_id=stage.id, key='foo', value='bar'),
        dict(stage_id=stage.id, key='baz', value='qux')
    ]

    for property in properties:
        StageProperty.create(**property)
    return stage
예제 #4
0
def insert_a_stage(name='foo', send_notifs=False, post_opportunities=False):
    stage = Stage.create(
        **{
            'name': name,
            'send_notifs': send_notifs,
            'post_opportunities': post_opportunities
        })

    properties = [
        dict(stage_id=stage.id, key='foo', value='bar'),
        dict(stage_id=stage.id, key='baz', value='qux')
    ]

    for property in properties:
        StageProperty.create(**property)
    return stage