Exemplo n.º 1
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         self.name,
         self.formset,
         "wshop/admin/services/_edit_weight_based_pricing_form.jinja",
         required=False,
         kwargs={"instance": self.component})
Exemplo n.º 2
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         "base",
         self.form,
         required=True,
         template_name="wshop/campaigns/admin/_edit_base_form.jinja",
         kwargs={"instance": self.object, "languages": settings.LANGUAGES, "request": self.request}
     )
Exemplo n.º 3
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         self.name,
         self.form,
         required=False,
         template_name="wshop/admin/settings/form_parts/settings_base.jinja",
         kwargs={"request": self.request}
     )
Exemplo n.º 4
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         self.name,
         self.formset,
         self.template_name,
         required=False,
         kwargs={"form": self.form, "owner": self.object},
     )
Exemplo n.º 5
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         "variables",
         VariationVariablesDataForm,
         template_name=
         "wshop/admin/products/variation/_variation_variables.jinja",
         required=False,
         kwargs={"parent_product": self.object})
Exemplo n.º 6
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         self.name,
         self.form,
         template_name="wshop/carousel/admin/_edit_base_form.jinja",
         required=True,
         kwargs={
             "instance": self.object,
         })
Exemplo n.º 7
0
    def get_form_defs(self):
        yield TemplatedFormDef(
            "shop%d" % self.shop.pk,
            ShopProductForm,
            template_name="wshop/admin/products/_edit_shop_form.jinja",
            required=True,
            kwargs={
                "instance": self.object,
                "initial": self.get_initial(),
                "request": self.request
            })

        # the hidden extra form template that uses ShopProductForm
        yield TemplatedFormDef(
            "shop%d_extra" % self.shop.pk,
            forms.Form,
            template_name="wshop/admin/products/_edit_extra_shop_form.jinja",
            required=False)
Exemplo n.º 8
0
 def get_form_defs(self):
     if not self.object.pk:
         return
     yield TemplatedFormDef(
         name=self.name,
         form_class=self.form,
         template_name="wshop/front/admin/sorts_and_filters.jinja",
         required=False,
         kwargs={"initial": get_configuration(category=self.object)})
Exemplo n.º 9
0
 def get_form_defs(self):
     if self.object.pk:  # Don't yield form if product is in new mode
         yield TemplatedFormDef(
             name=self.name,
             form_class=self.form,
             template_name="wshop/simple_supplier/admin/product_form_part.jinja",
             required=False,
             kwargs={"product": self.object.product, "request": self.request}
         )
Exemplo n.º 10
0
 def get_form_defs(self, form, template_name):
     yield TemplatedFormDef("children",
                            form,
                            template_name=template_name,
                            required=False,
                            kwargs={
                                "parent_product": self.object,
                                "request": self.request
                            })
Exemplo n.º 11
0
    def get_form_defs(self):
        yield TemplatedFormDef(
            "base",
            ProductBaseForm,
            template_name="wshop/admin/products/_edit_base_form.jinja",
            required=True,
            kwargs={
                "instance": self.object.product,
                "languages": settings.LANGUAGES,
                "initial": self.get_initial(),
                "request": self.request
            })

        yield TemplatedFormDef(
            "base_extra",
            forms.Form,
            template_name="wshop/admin/products/_edit_extra_base_form.jinja",
            required=False)
Exemplo n.º 12
0
 def get_form_defs(self):
     initial = {}
     yield TemplatedFormDef(
         "address",
         ContactAddressForm,
         template_name="wshop/admin/shops/_edit_contact_address_form.jinja",
         required=False,
         kwargs={"instance": self.object.contact_address, "initial": initial}
     )
Exemplo n.º 13
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         self.name,
         self.formset,
         template_name="wshop/carousel/admin/_edit_slide_form.jinja",
         required=False,
         kwargs={
             "carousel": self.object,
             "languages": settings.LANGUAGES
         })
Exemplo n.º 14
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         "base",
         CompanyContactBaseForm,
         template_name="wshop/admin/contacts/_edit_base_form.jinja",
         required=True,
         kwargs={
             "instance": self.object if self.object.pk else None,
             "request": self.request
         })
Exemplo n.º 15
0
    def get_form_defs(self):
        if not self.object.pk:
            return

        yield TemplatedFormDef(
            name=self.name,
            form_class=self.form,
            template_name="wshop/admin/settings/form_parts/shop.jinja",
            required=False,
            kwargs={"shop": self.object})
Exemplo n.º 16
0
    def get_form_defs(self):
        contact_group = self.object

        yield TemplatedFormDef(
            "base",
            ContactGroupBaseForm,
            template_name="wshop/admin/contact_groups/_edit_base_contact_group_form.jinja",
            required=True,
            kwargs={"instance": contact_group, "languages": settings.LANGUAGES}
        )
Exemplo n.º 17
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         "base",
         CategoryBaseForm,
         template_name="wshop/admin/categories/_edit_base_form.jinja",
         required=True,
         kwargs={
             "instance": self.object,
             "request": self.request,
             "languages": settings.LANGUAGES
         })
Exemplo n.º 18
0
 def get_form_defs(self):
     yield TemplatedFormDef(
         name="customer_group_discount",
         form_class=CustomerGroupDiscountForm,
         template_name=
         "wshop/admin/customer_group_pricing/discount_form_part.jinja",
         required=False,
         kwargs={
             "product": self.object.product,
             "request": self.request
         })
Exemplo n.º 19
0
 def get_form_defs(self):
     if not self.object.product.get_available_attribute_queryset():
         return
     yield TemplatedFormDef(
         "attributes",
         ProductAttributesForm,
         template_name="wshop/admin/products/_edit_attribute_form.jinja",
         required=False,
         kwargs={
             "product": self.object.product,
             "languages": settings.LANGUAGES
         })
Exemplo n.º 20
0
    def get_form_defs(self):
        contact_group = self.object
        form = formset_factory(ContactGroupMembersForm, ContactGroupMembersFormSet, extra=1, can_delete=True)
        template_name = "wshop/admin/contact_groups/_edit_members_form.jinja"

        if contact_group.pk:
            yield TemplatedFormDef(
                "members",
                form,
                template_name=template_name,
                required=False,
                kwargs={"contact_group": contact_group, "request": self.request}
            )
Exemplo n.º 21
0
    def get_form_defs(self):
        if not self.object.pk or self.object.identifier in PROTECTED_CONTACT_GROUP_IDENTIFIERS:
            return

        for shop in self.shops:
            instance, _ = ContactGroupSalesRange.objects.get_or_create(group=self.object, shop=shop)
            yield TemplatedFormDef(
                name=self._get_form_name(shop),
                form_class=self.form,
                template_name="wshop/campaigns/admin/sales_ranges_form_part.jinja",
                required=False,
                kwargs={"instance": instance}
            )
Exemplo n.º 22
0
    def get_form_defs(self):
        if not self.object.pk:
            return

        yield TemplatedFormDef(
            self.name,
            self.formset,
            template_name="wshop/admin/products/_edit_media_form.jinja",
            required=False,
            kwargs={
                "product": self.object.product,
                "languages": settings.LANGUAGES,
                "request": self.request
            })
Exemplo n.º 23
0
    def get_form_defs(self):
        if not self.object.pk:
            return

        shop = self.request.shop
        yield TemplatedFormDef(
            self._get_form_name(shop),
            CategoryProductForm,
            template_name="wshop/admin/categories/_edit_products_form.jinja",
            required=True,
            kwargs={
                "shop": shop,
                "category": self.object
            })
Exemplo n.º 24
0
 def get_form_defs(self):
     if not self.object.pk:
         return
     initial = {
         "shipping_method_required":
         configuration.get(self.object, SHIPPING_METHOD_REQUIRED_CONFIG_KEY,
                           True),
         "payment_method_required":
         configuration.get(self.object, PAYMENT_METHOD_REQUIRED_CONFIG_KEY,
                           True)
     }
     yield TemplatedFormDef(
         name=self.name,
         form_class=self.form,
         template_name="wshop/front/admin/checkout.jinja",
         required=False,
         kwargs={"initial": initial})
Exemplo n.º 25
0
 def get_form_defs(self):
     initial = {
     }  # TODO: should we do this? model_to_dict(self.object, AddressForm._meta.fields)
     address_form_class = cached_load("WSHOP_ADDRESS_MODEL_FORM")
     yield FormDef(name="shipping_address",
                   form_class=address_form_class,
                   required=False,
                   kwargs={
                       "instance": self.object.default_shipping_address,
                       "initial": initial
                   })
     yield FormDef(name="billing_address",
                   form_class=address_form_class,
                   required=False,
                   kwargs={
                       "instance": self.object.default_billing_address,
                       "initial": initial
                   })
     # Using a pseudo formdef to group the two actual formdefs...
     yield TemplatedFormDef(
         name="addresses",
         form_class=forms.Form,
         required=False,
         template_name="wshop/admin/contacts/_edit_addresses_form.jinja")