Let's say I have an input on a step and another input to the next phase (I use the Session Wizard View I'm here). I like input from the previous step, which is required to validate the next phase input I recognized errors would be better to update the verifier to go to the show, if the input does not equal the input Priwaos stage, because I use Ajax validation I am doing the validation of the form of the DEGENGO before submitting
I thought about the session input verifier for the second phase with ThreadLocal.get_current_request () and compares it somehow but I do not think it's a good solution :) Any suggestions?
I think that should do it:
class MyWizard ( session Wizard view): def get_form_kwargs (self-phase): kwargs = {} Step == 'second_step': cleaned_data = self.get_cleaned_data_for_step ( 'first_step') kwargs.update ({ 'First_input': cleaned_data [ 'first_input'] }) returns Kwarg then you pop it in your second
class SecondForm (forms.Form): Def __init __ (self, * Argus, ** kwargs): self.first_input = kwargs.pop ('first_input', none) super (secondform, self) .__ init __ (* args, ** kwargs) Def clean (self): super (secondform , Self). Clean () If any (Self Errors): Return # compare self.first_input with self. Scaled-ddaata ['second_input'] returns self Scaled_data
No comments:
Post a Comment