Beispiel #1
0
 def get_form_defs(self):
     initial = {}  # TODO: should we do this? model_to_dict(self.object, AddressForm._meta.fields)
     yield FormDef(
         name="shipping_address", form_class=AddressForm,
         required=False, kwargs={"instance": self.object.default_shipping_address, "initial": initial}
     )
     yield FormDef(
         name="billing_address", form_class=AddressForm,
         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="shoop/admin/contacts/_edit_addresses_form.jinja"
     )
Beispiel #2
0
 def get_form_defs(self):
     yield FormDef(
         self.name,
         self.formset,
         required=False,
         kwargs={
             "form": self.form,
             "owner": self.object
         },
     )