• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python forms.get_form_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中shuup_tests.utils.forms.get_form_data函数的典型用法代码示例。如果您正苦于以下问题:Python get_form_data函数的具体用法?Python get_form_data怎么用?Python get_form_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_form_data函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_default_language_finnish

def test_default_language_finnish():
    activate("en")
    test_name_en = "Test shop"
    test_name_fi = "Testi kauppa"
    shop = get_default_shop()
    shop.name = test_name_en
    shop.public_name = test_name_en
    shop.save()

    shop_form = ShopBaseForm(instance=shop, languages=settings.LANGUAGES)
    assert shop_form.languages[0] == "fi"
    data = get_form_data(shop_form, prepared=True)
    assert data.get("name__en") == test_name_en
    assert not data.get("name__fi")
    shop_form = ShopBaseForm(data=data, instance=shop, languages=settings.LANGUAGES)
    shop_form.full_clean()
    assert not shop_form.is_valid() and shop_form.errors

    data["name__fi"] = test_name_fi
    data["public_name__fi"] = test_name_fi
    shop_form = ShopBaseForm(data=data, instance=shop, languages=settings.LANGUAGES)
    shop_form.full_clean()
    assert shop_form.is_valid() and not shop_form.errors
    shop_form.save()

    shop.set_current_language("en")
    assert shop.name == test_name_en, "English activated"
    shop.set_current_language("fi")
    assert shop.name == test_name_fi, "Finnish activated"
开发者ID:ruqaiya,项目名称:shuup,代码行数:29,代码来源:test_multilanguage_model_form.py


示例2: test_protected_fields

def test_protected_fields():
    activate("en")
    shop = Shop.objects.create(
        name="testshop",
        identifier="testshop",
        status=ShopStatus.ENABLED,
        public_name="test shop",
        domain="derp",
        currency="EUR"
    )
    get_currency("EUR")
    get_currency("USD")
    assert shop.name == "testshop"
    assert shop.currency == "EUR"
    assert not ConfigurationItem.objects.filter(shop=shop, key="languages").exists()
    shop_form = ShopBaseForm(instance=shop, languages=settings.LANGUAGES)
    assert not shop_form._get_protected_fields()  # No protected fields just yet, right?
    data = get_form_data(shop_form, prepared=True)
    shop_form = ShopBaseForm(data=data, instance=shop, languages=settings.LANGUAGES)
    _test_cleanliness(shop_form)
    shop_form.save()

    # Now let's make it protected!
    create_product(printable_gibberish(), shop=shop, supplier=get_default_supplier())
    order = create_random_order(customer=create_random_person(), shop=shop)
    assert order.shop == shop

    # And try again...
    data["currency"] = "USD"
    shop_form = ShopBaseForm(data=data, instance=shop, languages=settings.LANGUAGES)
    assert shop_form._get_protected_fields()  # So protected!
    _test_cleanliness(shop_form)
    shop = shop_form.save()
    assert shop.currency == "EUR"  # But the shop form ignored the change . . .
开发者ID:ruqaiya,项目名称:shuup,代码行数:34,代码来源:test_shop_edit.py


示例3: test_change_shop_price

def test_change_shop_price(form):
    product = _get_test_product()
    shop = get_default_shop()
    group = get_default_customer_group()
    price = shop.create_price

    form_field = "s_%d_g_%d" % (shop.id, group.id)
    frm = form(product=product, shop=shop, empty_permitted=True)
    form_data = get_form_data(frm, prepared=True)

    if form == CustomerGroupPricingForm:
        form_data[form_field] = "4000"
    else:
        form_data[form_field] = "50"

    frm = form(product=product, shop=shop, data=form_data, empty_permitted=True)
    frm.full_clean()
    frm.save()

    if form == CustomerGroupPricingForm:
        assert CgpPrice.objects.get(product=product, shop=shop, group=group).price == price(4000)
    else:
        assert CgpDiscount.objects.get(product=product, shop=shop, group=group).discount_amount == price(50)

    # Never mind actually, same price for all shops
    form_data[form_field] = ""

    frm = form(product=product, shop=shop, data=form_data, empty_permitted=True)
    frm.full_clean()
    frm.save()

    if form == CustomerGroupPricingForm:
        assert not CgpPrice.objects.filter(product=product, shop=shop, group=group).exists()
    else:
        assert not CgpDiscount.objects.filter(product=product, shop=shop, group=group).exists()
开发者ID:ruqaiya,项目名称:shuup,代码行数:35,代码来源:test_form.py


示例4: test_model_form_partially_translated

def test_model_form_partially_translated(rf, admin_user):
    with override_settings(**{"LANGUAGES": (("en", "en"), ("fi", "fi"), ("ja", "ja")),
                              "PARLER_DEFAULT_LANGUAGE_CODE": "en"}):
        activate("en")
        get_default_shop()
        request = apply_request_middleware(rf.get("/"), user=admin_user)
        test_name_en = "Test shop"
        payment_method = get_default_payment_method()
        payment_method.name = test_name_en
        payment_method.save()

        form = PaymentMethodForm(instance=payment_method, request=request, languages=settings.LANGUAGES)
        data = get_form_data(form, prepared=True)
        assert data.get("name__en") == test_name_en
        assert not data.get("name__fi")
        form = PaymentMethodForm(data=data, instance=payment_method, request=request, languages=settings.LANGUAGES)
        form.full_clean()
        assert form.is_valid() and not form.errors
        payment_method = form.save()

        # Add description for Finnish and and name in Finnish should be required
        data["description__fi"] = "Some description"
        form = PaymentMethodForm(data=data, instance=payment_method, request=request, languages=settings.LANGUAGES)
        form.full_clean()
        assert not form.is_valid() and form.errors

        test_name_fi = "Some method name in finnish"
        data["name__fi"] = test_name_fi
        form = PaymentMethodForm(data=data, instance=payment_method, request=request, languages=settings.LANGUAGES)
        form.full_clean()
        assert form.is_valid() and not form.errors
        payment_method = form.save()

        assert payment_method.name == test_name_en, "Object in English"

        activate("fi")
        payment_method.set_current_language("fi")
        assert payment_method.name == test_name_fi, "Object in Finnish"

        activate("ja")
        payment_method.set_current_language("ja")
        assert payment_method.name == test_name_en, "Should fallback to English"

        # Check that no sneaky translations is not created for Japan
        with pytest.raises(ObjectDoesNotExist):
            translation = payment_method.get_translation("ja")
            translation.refresh_from_db()  # Just in case if the translation object comes from cache or something

        # Empty finnish translations and see if Finnish starts fallbacks too
        data["name__fi"] = data["description__fi"] = ""
        form = PaymentMethodForm(data=data, instance=payment_method, request=request, languages=settings.LANGUAGES)
        form.full_clean()
        assert form.is_valid() and not form.errors
        form.save()

        # Check that no sneaky translations is not created for Finnish
        with pytest.raises(ObjectDoesNotExist):
            translation = payment_method.get_translation("fi")
            translation.refresh_from_db()  # Just in case if the translation object comes from cache or something
开发者ID:ruqaiya,项目名称:shuup,代码行数:59,代码来源:test_multilanguage_model_form.py


示例5: test_no_changes_into_form

def test_no_changes_into_form():
    product = _get_test_product()
    shop = get_default_shop()
    frm = CustomerGroupPricingForm(product=product, empty_permitted=True)
    # No changes made, right?
    form_data = get_form_data(frm, prepared=True)
    frm = CustomerGroupPricingForm(product=product, data=form_data, empty_permitted=True)
    frm.full_clean()
    frm.save()
    assert CgpPrice.objects.get(product=product, shop=shop).price.value == 250
开发者ID:NamiStudio,项目名称:shuup,代码行数:10,代码来源:test_form.py


示例6: test_simple_children_formset

def test_simple_children_formset():
    FormSet = formset_factory(SimpleVariationChildForm, SimpleVariationChildFormSet, extra=5, can_delete=True)
    parent = create_product(printable_gibberish())
    child = create_product(printable_gibberish())

    # No links yet
    formset = FormSet(parent_product=parent)
    assert formset.initial_form_count() == 0  # No children yet

    # Save a link
    data = dict(get_form_data(formset, True), **{"form-0-child": child.pk})
    formset = FormSet(parent_product=parent, data=data)
    formset.save()
    assert parent.variation_children.filter(pk=child.pk).exists()  # Got link'd!

    # Remove the link
    formset = FormSet(parent_product=parent)
    assert formset.initial_form_count() == 1  # Got the child here
    data = dict(get_form_data(formset, True), **{"form-0-DELETE": "1"})
    formset = FormSet(parent_product=parent, data=data)
    formset.save()
    assert not parent.variation_children.exists()  # Got unlinked
开发者ID:suutari,项目名称:shoop,代码行数:22,代码来源:test_product_variation.py


示例7: test_contact_group_members_formset

def test_contact_group_members_formset(rf):
    FormSet = formset_factory(ContactGroupMembersForm, ContactGroupMembersFormSet, extra=1, can_delete=True)
    contact_group = get_default_customer_group()
    person = create_random_person()

    # No members
    formset = FormSet(contact_group=contact_group)
    assert formset.initial_form_count() == 0

    # Add a member
    data = dict(get_form_data(formset, True), **{"form-0-member": person.pk})
    formset = FormSet(contact_group=contact_group, data=data)
    formset.save()
    assert contact_group.members.filter(pk=person.pk).exists()
开发者ID:ruqaiya,项目名称:shuup,代码行数:14,代码来源:test_contact_group_edit.py


示例8: test_cannot_add_product_to_own_package

def test_cannot_add_product_to_own_package(rf):
    FormSet = formset_factory(PackageChildForm, PackageChildFormSet, extra=5, can_delete=True)
    parent = create_product(printable_gibberish())

    # No products in the package
    formset = FormSet(parent_product=parent)
    assert formset.initial_form_count() == 0 # No children yet

    assert not parent.get_all_package_children()

    # Try to add a product to its own package
    data = dict(get_form_data(formset, True), **{"form-0-child": parent.pk, "form-0-quantity": 2})
    formset = FormSet(parent_product=parent, data=data)
    formset.save()
    assert not parent.get_all_package_children()
开发者ID:suutari,项目名称:shoop,代码行数:15,代码来源:test_product_package.py


示例9: test_default_language_english

def test_default_language_english():
    activate("en")
    test_name_en = "Test shop"
    shop = get_default_shop()
    shop.name = test_name_en
    shop.public_name = test_name_en
    shop.save()

    shop_form = ShopBaseForm(instance=shop, languages=settings.LANGUAGES)
    data = get_form_data(shop_form, prepared=True)
    assert data.get("name__en") == test_name_en
    assert not data.get("name__fi")
    shop_form = ShopBaseForm(data=data, instance=shop, languages=settings.LANGUAGES)
    shop_form.full_clean()
    assert shop_form.is_valid() and not shop_form.errors
开发者ID:ruqaiya,项目名称:shuup,代码行数:15,代码来源:test_multilanguage_model_form.py


示例10: test_product_attributes_form

def test_product_attributes_form():
    # Come up with a decent product...
    product = create_product("TestProduct", shop=get_default_shop())
    assert product.type.attributes.count()
    product.set_attribute_value("bogomips", 6400)
    product.set_attribute_value("genre", "Kauhu", "fi")
    product.set_attribute_value("genre", "Horror", "en")
    product.set_attribute_value("time_to_finish", 12.05)
    product.set_attribute_value("release_date", VOGONY_DATE)
    assert product.get_attribute_value("bogomips") == 6400

    # English is missing on purpose from the languages list; it'll still be available
    # for `genre` as it has an extant value.
    paf = ProductAttributesForm(product=product, languages=("fi", "sv"), default_language="sv")
    assert paf.languages[0] == "sv"

    assert compare_partial_dicts(paf.initial, {  # Check that things get loaded.
        "bogomips": 6400,
        "genre__fi": "Kauhu",
        "genre__en": "Horror",
        "release_date": VOGONY_DATE,
        "time_to_finish": Decimal("12.05")
    })
    form_data = get_form_data(paf)
    form_data.update({  # Change, clear and add fields
        "genre__sv": "Skräck",
        "genre__en": "Terror",
        "bogomips": "",
        "release_date": "",
        "awesome": "True",
        "important_datetime": make_aware(datetime.datetime(2000, 1, 1, 1, 2, 3), utc)
    })
    paf = ProductAttributesForm(product=product, languages=("fi", "sv"), default_language="sv", data=form_data)
    paf.full_clean()
    assert not paf.errors
    paf.save()

    for identifier in ("bogomips", "release_date"):
        # Value should be gone
        assert not product.get_attribute_value(identifier)
        # ... and so should the actual product attribute object
        assert not ProductAttribute.objects.filter(attribute__identifier=identifier, product=product).exists()

    # Those other values got updated, right?
    assert product.get_attribute_value("genre", "en") == form_data["genre__en"]
    assert product.get_attribute_value("genre", "sv") == form_data["genre__sv"]
    assert product.get_attribute_value("awesome") is True
    assert str(product.get_attribute_value("important_datetime")) == "2000-01-01 01:02:03+00:00"
开发者ID:gurch101,项目名称:shuup,代码行数:48,代码来源:test_product_attributes_form.py


示例11: test_product_not_in_normal_mode

def test_product_not_in_normal_mode():
    FormSet = formset_factory(PackageChildForm, PackageChildFormSet, extra=5, can_delete=True)
    parent = create_product(printable_gibberish())
    child_1 = create_product(printable_gibberish())
    child_1.link_to_parent(parent)
    child_2 = create_product(printable_gibberish())
    parent.verify_mode()

    assert parent.mode == ProductMode.SIMPLE_VARIATION_PARENT

    # Trying to create a package from a non-normal mode product
    with pytest.raises(Problem):
        formset = FormSet(parent_product=parent)
        data = dict(get_form_data(formset, True), **{"form-0-child": child_2.pk, "form-0-quantity": 2})
        formset = FormSet(parent_product=parent, data=data)
        formset.save()
开发者ID:suutari,项目名称:shoop,代码行数:16,代码来源:test_product_package.py


示例12: test_category_form_saving

def test_category_form_saving(rf):
    with transaction.atomic():
        category = CategoryFactory()
        form_kwargs = dict(instance=category, languages=("sw",), default_language="sw")
        form = CategoryBaseForm(**form_kwargs)
        assert isinstance(form, CategoryBaseForm)
        form_data = get_form_data(form, prepared=True)
        for lang, field_map in form.trans_name_map.items():
            for dst_field in field_map.values():
                form_data[form.add_prefix(dst_field)] = "IJWEHGWOHKSL"
        form_kwargs["data"] = form_data
        form = CategoryBaseForm(**form_kwargs)
        form.full_clean()
        form.save()
        category = form.instance
        category.set_current_language("sw")
        assert category.name == "IJWEHGWOHKSL"
开发者ID:NamiStudio,项目名称:shuup,代码行数:17,代码来源:test_category_module.py


示例13: test_address_assigned_to_multiple_times_for_one_contact

def test_address_assigned_to_multiple_times_for_one_contact():
    person = create_random_person()
    address = create_random_address()
    person.default_billing_address = person.default_shipping_address = address
    person.save()

    assert person.default_billing_address_id == address.id
    assert person.default_shipping_address_id == address.id
    form = MutableAddressForm(instance=address)
    data = get_form_data(form, prepared=True)
    form = MutableAddressForm(data=data, instance=address)
    form.full_clean()
    assert not form.errors
    assert form.cleaned_data
    form.save()
    address.refresh_from_db()
    assert person.default_billing_address_id != address.id
    assert person.default_shipping_address_id != address.id
开发者ID:suutari,项目名称:shoop,代码行数:18,代码来源:test_default_address_form.py


示例14: test_package_child_formset

def test_package_child_formset():
    FormSet = formset_factory(PackageChildForm, PackageChildFormSet, extra=5, can_delete=True)
    parent = create_product(printable_gibberish())
    child = create_product(printable_gibberish())

    # No products in the package
    formset = FormSet(parent_product=parent)
    assert formset.initial_form_count() == 0 # No children yet

    assert not parent.get_all_package_children()

    data = dict(get_form_data(formset, True), **{"form-0-child": child.pk, "form-0-quantity": 2})
    formset = FormSet(parent_product=parent, data=data)
    formset.save()
    assert parent.get_all_package_children()

    clear_existing_package(parent)
    assert not parent.get_all_package_children()
开发者ID:suutari,项目名称:shoop,代码行数:18,代码来源:test_product_package.py


示例15: test_impossible_simple_variation

def test_impossible_simple_variation():
    FormSet = formset_factory(SimpleVariationChildForm, SimpleVariationChildFormSet, extra=5, can_delete=True)
    parent = create_product(printable_gibberish())
    child = create_product(printable_gibberish())
    grandchild = create_product(printable_gibberish())
    grandchild.link_to_parent(child)
    assert child.variation_children.exists()

    formset = FormSet(parent_product=parent)
    data = dict(get_form_data(formset, True), **{"form-0-child": child.pk})
    formset = FormSet(parent_product=parent, data=data)
    assert formset.is_valid()  # It's technically valid, but...
    with pytest.raises(Problem) as ei:
        formset.save()

    if six.PY3:  # Can only test inner exceptions on Py3. Ah well.
        inner_exc = ei.value.__context__
        assert isinstance(inner_exc, ImpossibleProductModeException)
        assert inner_exc.code == "multilevel"
开发者ID:suutari,项目名称:shoop,代码行数:19,代码来源:test_product_variation.py


示例16: test_category_form_with_parent

def test_category_form_with_parent(rf, admin_user):
    with transaction.atomic():
        shop = get_default_shop()
        category1 = CategoryFactory()
        category2 = CategoryFactory()
        category2.shops.clear()
        assert shop not in category2.shops.all()
        category3 = CategoryFactory()
        category3.shops.clear()
        assert shop not in category3.shops.all()

        request = apply_request_middleware(rf.get("/"), user=admin_user, shop=shop)
        form_kwargs = dict(instance=category1, request=request, languages=("sw",), default_language="sw")
        form = CategoryBaseForm(**form_kwargs)
        assert isinstance(form, CategoryBaseForm)
        form_data = get_form_data(form, prepared=True)
        for lang, field_map in form.trans_name_map.items():
            for dst_field in field_map.values():
                form_data[form.add_prefix(dst_field)] = "IJWEHGWOHKSL"

        # Make sure we have right parent options
        parent_bound_field = [field for field in form.visible_fields() if field.name == "parent"][0]
        assert len(parent_bound_field.field.choices) == 1
        assert parent_bound_field.field.choices[0][0] is None

        category2.shops.add(shop)
        form_kwargs["data"] = form_data
        form = CategoryBaseForm(**form_kwargs)
        assert isinstance(form, CategoryBaseForm)

        # Make sure category 2 is now in parent options
        parent_bound_field = [field for field in form.visible_fields() if field.name == "parent"][0]
        assert len(parent_bound_field.field.choices) == 2
        assert parent_bound_field.field.choices[1][0] == category2.id

        # Make sure saving the form still works
        form.full_clean()
        form.save()
        category = form.instance
        category.set_current_language("sw")
        assert category.name == "IJWEHGWOHKSL"
开发者ID:ruqaiya,项目名称:shuup,代码行数:41,代码来源:test_category_module.py


示例17: test_editor_save

def test_editor_save(rf):
    layout, svc = get_test_layout_and_svc()

    with initialize_editor_view(svc.view_name, layout.placeholder_name) as view_obj:
        view_obj.request.GET.update({"x": 0, "y": 0})
        view_obj.dispatch(view_obj.request)
        assert view_obj.current_cell
        assert view_obj.form
        assert "general" in view_obj.form.forms
        assert "plugin" in view_obj.form.forms
        form_data = get_form_data(view_obj.form, prepared=True)
    new_text = printable_gibberish()
    form_data["plugin-text_%s" % FALLBACK_LANGUAGE_CODE] = new_text
    form_data["save"] = "1"
    request = rf.post("/pepe/", data=form_data)  # sort of rare pepe
    request.GET = dict(request.GET, x=0, y=0)
    with initialize_editor_view(svc.view_name, layout.placeholder_name, request) as view_obj:
        view_obj.dispatch(request)
        assert view_obj.form
        assert not view_obj.form.errors
        assert view_obj.current_cell.config["text"] == {FALLBACK_LANGUAGE_CODE: new_text}
开发者ID:gurch101,项目名称:shuup,代码行数:21,代码来源:test_editor_view.py


示例18: test_rule_admin

def test_rule_admin(rf, admin_user):
    shop = get_default_shop()

    tax = create_tax("test-1", rate=Decimal("0.12"))
    tax.save()

    tax_class = TaxClass.objects.create(name="test")

    view = TaxRuleEditView(request=apply_request_middleware(rf.get("/"), user=admin_user))
    form_class = view.get_form_class()
    form_kwargs = view.get_form_kwargs()
    form = form_class(**form_kwargs)
    data = get_form_data(form)
    data.update({
        "shop": shop.pk,
        "postal_codes_pattern": "99501-99511,99513-99524,99529-99530,99540,99590,99550,99567,99573,99577,99586-99588",
        "country_codes_pattern": "FI,CA,US,SE",
        "region_codes_pattern": "CA,AR,IA,AK,WY,TN",
        "tax": tax.id,
        "tax_classes": [tax_class.id]
    })
    form = form_class(**dict(form_kwargs, data=data))
    form.full_clean()

    assert not form.errors

    rule = form.save()

    assert rule._postal_codes_min == "99501"
    assert rule._postal_codes_max == "99590"

    postal_code = "99510"
    assert TaxRule.objects.may_match_postal_code(postal_code).count() == 1

    postal_code = "99500"
    assert not TaxRule.objects.may_match_postal_code(postal_code).count()
开发者ID:suutari,项目名称:shoop,代码行数:36,代码来源:test_default_tax.py


示例19: test_page_form

def test_page_form(rf):
    view = PageEditView(request=rf.get("/"))
    form_class = view.get_form_class()
    form_kwargs = view.get_form_kwargs()
    form = form_class(**form_kwargs)
    assert not form.is_bound

    data = get_form_data(form)
    data.update({
        "available_from": "",
        "available_to": "",
        "content__en": "",
        "content__fi": "suomi",
        "content__ja": "",
        "identifier": "",
        "title__en": "",
        "title__fi": "",
        "title__ja": "",
        "url__en": "",
        "url__fi": "suomi",
        "url__ja": "",
    })

    form = form_class(**dict(form_kwargs, data=data))
    form.full_clean()
    assert "title__fi" in form.errors  # We get an error because all of a given language's fields must be filled if any are
    data["title__fi"] = "suomi"
    form = form_class(**dict(form_kwargs, data=data))
    form.full_clean()
    assert not form.errors
    page = form.save()
    assert set(page.get_available_languages()) == {"fi"}  # The page should be only in Finnish
    # Let's edit that page
    original_url = "errrnglish"
    data.update({"title__en": "englaish", "url__en": original_url, "content__en": "ennnn ennnn ennnnnnn-nn-n-n"})
    form = form_class(**dict(form_kwargs, data=data, instance=page))
    form.full_clean()
    assert not form.errors
    page = form.save()
    assert set(page.get_available_languages()) == {"fi", "en"}  # English GET

    # Try to make page a child of itself
    data.update({"parent": page.pk})
    form = form_class(**dict(form_kwargs, data=data, instance=page))
    form.full_clean()
    assert form.errors
    del data["parent"]

    # add dummy page with simple url, page is in english
    dummy = create_page(url="test")

    # edit page again and try to set duplicate url
    data.update({"title__en": "englaish", "url__en": "test", "content__en": "ennnn ennnn ennnnnnn-nn-n-n"})
    form = form_class(**dict(form_kwargs, data=data, instance=page))
    form.full_clean()

    assert len(form.errors) == 1
    assert "url__en" in form.errors
    assert form.errors["url__en"].as_data()[0].code == "invalid_url"

    # it should be possible to change back to the original url
    data.update({"title__en": "englaish", "url__en": original_url, "content__en": "ennnn ennnn ennnnnnn-nn-n-n"})
    form = form_class(**dict(form_kwargs, data=data, instance=page))
    form.full_clean()
    assert not form.errors
    page = form.save()

    # add finnish urls, it should not be possible to enter original url
    data.update({"title__fi": "englaish", "url__fi": original_url, "content__fi": "ennnn ennnn ennnnnnn-nn-n-n"})
    form = form_class(**dict(form_kwargs, data=data, instance=page))
    form.full_clean()
    assert len(form.errors) == 1
    assert "url__fi" in form.errors
    assert form.errors["url__fi"].as_data()[0].code == "invalid_url"
开发者ID:NamiStudio,项目名称:shuup,代码行数:74,代码来源:test_page_creation.py



注:本文中的shuup_tests.utils.forms.get_form_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.get_jinja2_engine函数代码示例发布时间:2022-05-27
下一篇:
Python basketish_order_source.BasketishOrderSource类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap