Currently, I have the following:
class ConfirmStepAView(UpdateProcessView):
form_class = ConfirmationForm
def validate(self):
if not self.process.A:
raise ValidationError
class ConfirmStepBView(UpdateProcessView):
form_class = ConfirmationForm
def validate(self):
if not self.process.B:
raise ValidationError
# Usage:
flow.View(ConfirmStepAView)
flow.View(ConfirmStepBView)
How can I write a factory method that generates these classes on the fly so I can do something like this?
flow.View(ConfirmStepViewFactory('A'))
flow.View(ConfirmStepViewFactory('B'))
flow.View(ConfirmStepViewFactory('Something'))
flow.View(ConfirmStepViewFactory('Else'))
Note: I have to use this format because I am working with a third part library.