class NewShipmentView(LayoutMixin, CreateView): title = "New Shipment" model = Shipment layout = Layout( Row('first_name', 'last_name', 'email'), Row('phone'), Fieldset('Address', Row(Span7('address'), Span5('zipcode')), Row(Span5('city'), Span2('state'), Span5('country'))), )
class NewShipmentView(LayoutMixin, extra_views.NamedFormsetsMixin, extra_views.CreateWithInlinesView): title = "New Shipment" model = Shipment layout = Layout( Row('first_name', 'last_name', 'email'), Row('phone'), Fieldset('Address', Row(Span7('address'), Span5('zipcode')), Row(Span5('city'), Span2('state'), Span5('country'))), Inline('Shipment Items', ItemInline), )
class StartView(StartFlowMixin, generic.UpdateView): form_class = ShipmentForm layout = Layout( Row('shipment_no'), Fieldset('Customer Details', Row('first_name', 'last_name', 'email'), Row('phone')), Fieldset('Address', Row(Span7('address'), Span5('zipcode')), Row(Span5('city'), Span2('state'), Span5('country'))), 'items', ) def get_object(self): return self.activation.process.shipment def activation_done(self, form): shipment = form.save() self.activation.process.shipment = shipment super(StartView, self).activation_done(form)
class StartView(LayoutMixin, flow_views.StartViewMixin, extra_views.NamedFormsetsMixin, extra_views.CreateWithInlinesView): model = Shipment layout = Layout( Row('shipment_no'), Fieldset('Customer Details', Row('first_name', 'last_name', 'email'), Row('phone')), Fieldset('Address', Row(Span7('address'), Span5('zipcode')), Row(Span5('city'), Span2('state'), Span5('country'))), Inline('Shipment Items', ItemInline), ) def activation_done(self, form, inlines): self.object = form.save() for formset in inlines: formset.save() self.activation.process.created_by = self.request.user self.activation.process.shipment = self.object self.activation.done()