Esempio n. 1
0
def edit_field(step, field_name, model, field_value):
    formatted_field_name = world.format_field_name(field_name)
    try:
        world.browser.fill(formatted_field_name, field_value)
    except ElementDoesNotExist:
        translated_field_name = "%stranslation_set-0-%s" % (model.lower(), formatted_field_name)
        world.browser.fill(translated_field_name, field_value) 
    world.set_changed(model, field_name)
Esempio n. 2
0
def edit_tinymce_field(step, language, field_name, model):
    translation_form = world.find_translation_form(language, model)
    formatted_field_name = world.format_field_name(field_name)
    field_id = "id_%s-%s" % (translation_form['id'],
                             formatted_field_name)
    # HACK: Disable TinyMCE because splinter can't yet deal with it
    world.browser.execute_script("tinyMCE.getInstanceById('%s').remove()" % field_id)
    world.browser.fill("%s-%s" % (translation_form['id'], formatted_field_name), step.multiline)
    world.set_changed(model, formatted_field_name)
Esempio n. 3
0
def edit_field(step, field_name, model, field_value):
    formatted_field_name = world.format_field_name(field_name)
    try:
        world.browser.fill(formatted_field_name, field_value)
    except ElementDoesNotExist:
        translated_field_name = "%stranslation_set-0-%s" % (
            model.lower(), formatted_field_name)
        world.browser.fill(translated_field_name, field_value)
    world.set_changed(model, field_name)
Esempio n. 4
0
def edit_tinymce_field(step, language, field_name, model):
    translation_form = world.find_translation_form(language, model)
    formatted_field_name = world.format_field_name(field_name)
    field_id = "id_%s-%s" % (translation_form['id'], formatted_field_name)
    # HACK: Disable TinyMCE because splinter can't yet deal with it
    world.browser.execute_script("tinyMCE.getInstanceById('%s').remove()" %
                                 field_id)
    world.browser.fill(
        "%s-%s" % (translation_form['id'], formatted_field_name),
        step.multiline)
    world.set_changed(model, formatted_field_name)
Esempio n. 5
0
def edit_datetime_field(step, model, field_name, date, time):
    formatted_field_name = world.format_field_name(field_name)
    world.browser.fill("%s_0" % formatted_field_name, date)
    world.browser.fill("%s_1" % formatted_field_name, time)
    world.set_changed(model, formatted_field_name)
Esempio n. 6
0
def select_field_option(step, option_text, field_name, model):
    formatted_field_name = world.format_field_name(field_name)
    world.select_option_by_text(formatted_field_name, option_text)
    world.set_changed(model, formatted_field_name)
Esempio n. 7
0
def edit_datetime_field(step, model, field_name, date, time):
    formatted_field_name = world.format_field_name(field_name)
    world.browser.fill("%s_0" % formatted_field_name, date)
    world.browser.fill("%s_1" % formatted_field_name, time)
    world.set_changed(model, formatted_field_name)
Esempio n. 8
0
def select_field_option(step, option_text, field_name, model):
    formatted_field_name = world.format_field_name(field_name)
    world.select_option_by_text(formatted_field_name, option_text)
    world.set_changed(model, formatted_field_name)