コード例 #1
0
ファイル: addresses.py プロジェクト: noyonthe1/shoop
 def get_form(self, form_class):
     fg = FormGroup(**self.get_form_kwargs())
     for kind in self.address_kinds:
         fg.add_form_def(kind, form_class=self.address_form_classes.get(kind, self.address_form_class))
     if self.company_form_class:
         fg.add_form_def("company", self.company_form_class, required=False)
     return fg
コード例 #2
0
ファイル: form_part.py プロジェクト: 00WhengWheng/shuup
 def get_form(self, form_class=None):
     kwargs = self.get_form_kwargs()
     instance = kwargs.pop("instance", None)
     if not instance.pk:
         kwargs["initial"] = dict(self.request.GET.items())
     fg = FormGroup(**kwargs)
     form_parts = self.get_form_parts(instance)
     for form_part in form_parts:
         for form_def in form_part.get_form_defs():
             fg.form_defs[form_def.name] = form_def
     fg.instantiate_forms()
     return fg
コード例 #3
0
 def get_form(self, form_class=None):
     kwargs = self.get_form_kwargs()
     instance = kwargs.pop("instance", None)
     if not instance.pk:
         kwargs["initial"] = dict(self.request.GET.items())
     fg = FormGroup(**kwargs)
     form_parts = self.get_form_parts(instance)
     for form_part in form_parts:
         for form_def in form_part.get_form_defs():
             fg.form_defs[form_def.name] = form_def
     fg.instantiate_forms()
     return fg
コード例 #4
0
ファイル: test_form_group.py プロジェクト: sidaga/shoop
def make_form_group(**kwargs):
    AddressForm = modelform_factory(Address, fields=("name", ))
    fg = FormGroup(**kwargs)
    fg.add_form_def("address1", AddressForm, required=True)
    fg.add_form_def("address2", AddressForm, required=False)
    fg.add_form_def("general", GeneralForm, required=True)
    return fg
コード例 #5
0
 def get_form(self, form_class):
     contact = get_person_contact(self.request.user)
     form_group = FormGroup(**self.get_form_kwargs())
     form_group.add_form_def("billing", AddressForm, kwargs={"instance": contact.default_billing_address})
     form_group.add_form_def("shipping", AddressForm, kwargs={"instance": contact.default_shipping_address})
     form_group.add_form_def("contact", PersonContactForm, kwargs={"instance": contact})
     return form_group
コード例 #6
0
ファイル: single_page.py プロジェクト: teserak/shoop
 def get_form(self, form_class):
     kwargs = self.get_form_kwargs()
     fg = FormGroup(data=kwargs.get("data"), files=kwargs.get("files"))
     fg.add_form_def("billing", self.billing_address_form_class)
     fg.add_form_def("shipping", self.shipping_address_form_class)
     fg.add_form_def("order", self.order_form_class, kwargs={
         "basket": self.request.basket,
         "shop": self.request.shop
     })
     return fg
コード例 #7
0
ファイル: views.py プロジェクト: Carolina061/shoop
 def get_form(self, form_class):
     contact = get_person_contact(self.request.user)
     form_group = FormGroup(**self.get_form_kwargs())
     form_group.add_form_def("billing", AddressForm, kwargs={"instance": contact.default_billing_address})
     form_group.add_form_def("shipping", AddressForm, kwargs={"instance": contact.default_shipping_address})
     form_group.add_form_def("contact", PersonContactForm, kwargs={"instance": contact})
     return form_group
コード例 #8
0
ファイル: test_form_group.py プロジェクト: taedori81/shoop
def make_form_group(**kwargs):
    AddressForm = modelform_factory(MutableAddress, fields=("name", ))
    fg = FormGroup(**kwargs)
    fg.add_form_def("address1", AddressForm, required=True)
    fg.add_form_def("address2", AddressForm, required=False)
    fg.add_form_def("general", GeneralForm, required=True)
    return fg
コード例 #9
0
ファイル: single_page.py プロジェクト: cuberskulk/shoop
 def get_form(self, form_class):
     kwargs = self.get_form_kwargs()
     fg = FormGroup(data=kwargs.get("data"), files=kwargs.get("files"))
     fg.add_form_def("billing", self.billing_address_form_class)
     fg.add_form_def("shipping", self.shipping_address_form_class)
     fg.add_form_def(
         "order", self.order_form_class, kwargs={"basket": self.request.basket, "shop": self.request.shop}
     )
     return fg
コード例 #10
0
 def get_form(self, form_class):
     fg = FormGroup(**self.get_form_kwargs())
     for kind in self.address_kinds:
         fg.add_form_def(kind, form_class=self.address_form_classes.get(kind, self.address_form_class))
     if self.company_form_class and not self.request.customer:
         fg.add_form_def("company", self.company_form_class, required=False)
     return fg