flows: add ConfigurableStage base class and ConfigureFlowInitView
This commit is contained in:
@ -37,7 +37,7 @@ class FlowDesignation(models.TextChoices):
|
||||
ENROLLMENT = "enrollment"
|
||||
UNRENOLLMENT = "unenrollment"
|
||||
RECOVERY = "recovery"
|
||||
STAGE_SETUP = "stage_setup"
|
||||
STAGE_CONFIGURATION = "stage_configuration"
|
||||
|
||||
|
||||
class Stage(SerializerModel):
|
||||
@ -73,6 +73,29 @@ class Stage(SerializerModel):
|
||||
return f"Stage {self.name}"
|
||||
|
||||
|
||||
class ConfigurableStage(models.Model):
|
||||
"""Abstract base class for a Stage that can be configured by the enduser.
|
||||
The stage should create a default flow with the configure_stage designation during
|
||||
migration."""
|
||||
|
||||
configure_flow = models.ForeignKey(
|
||||
'passbook_flows.Flow',
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text=_(
|
||||
(
|
||||
"Flow used by an authenticated user to change their password. "
|
||||
"If empty, user will be unable to change their password."
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
||||
abstract = True
|
||||
|
||||
|
||||
def in_memory_stage(view: Type["StageView"]) -> Stage:
|
||||
"""Creates an in-memory stage instance, based on a `_type` as view."""
|
||||
stage = Stage()
|
||||
|
Reference in New Issue
Block a user