Re: [Django] #10810: FormWizard validates the last form twice

11 views
Skip to first unread message

Django

unread,
Jun 1, 2011, 9:56:26 AM6/1/11
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
------------------------------------+-----------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: closed
Milestone: | Component: contrib.formtools
Version: SVN | Severity: Normal
Resolution: wontfix | Keywords: wizard validation
Triage Stage: Accepted | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 1 | Easy pickings: 0
------------------------------------+-----------------------------------
Changes (by jezdez):

* status: new => closed
* resolution: => wontfix
* easy: => 0


Comment:

Superseded by #9200.

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 27, 2012, 7:16:37 AM5/27/12
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: reopened
Component: contrib.formtools | Version: master
Severity: Normal | Resolution:
Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by hal_robertson@…):

* status: closed => reopened
* ui_ux: => 0
* resolution: wontfix =>


Comment:

Replying to [comment:8 jezdez]:
> Superseded by #9200.

why does the last form need to be validated twice?

the above could be modified as:

1. first validation after each form is submitted
2. second validation, once we validate the last form, when all wizard
forms are validated together (all except the last one again!), .

that way you could retain the ability to put a captcha on the last form

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:9>

Django

unread,
May 27, 2012, 8:17:55 AM5/27/12
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: reopened
Component: contrib.formtools | Version: master
Severity: Normal | Resolution:
Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

Comment (by hal_robertson@…):

Replying to [comment:9 hal_robertson@…]:

> Replying to [comment:8 jezdez]:
> > Superseded by #9200.
>
> why does the last form need to be validated twice?
>
> the above could be modified as:
>
> 1. first validation after each form is submitted
> 2. second validation, once we validate the last form, when all wizard
forms are validated together (all except the last one again!), .
>
> that way you could retain the ability to put a captcha on the last form

{{{
--- views.py 2012-05-27 09:15:46.000000000 -0300
+++ views.py.new 2012-05-27 09:15:25.000000000 -0300
@@ -316,11 +316,11 @@
# walk through the form list and try to validate the data again.
for form_key in self.get_form_list():
form_obj = self.get_form(step=form_key,
data=self.storage.get_step_data(form_key),
files=self.storage.get_step_files(form_key))
- if not form_obj.is_valid():
+ if not form_obj.is_valid() and form_key != self.steps.last:
return self.render_revalidation_failure(form_key,
form_obj, **kwargs)
final_form_list.append(form_obj)

# render the done view and reset the wizard before returning the
# response. This is needed to prevent from rendering done with
the
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:10>

Django

unread,
May 27, 2012, 8:21:20 AM5/27/12
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: reopened
Component: contrib.formtools | Version: master
Severity: Normal | Resolution:
Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

Comment (by anonymous):

woops... massive mistake there! that if statement should be the other way
around!

{{{
if form_key != self.steps.last and not form_obj.is_valid():
}}}

sorry...

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:11>

Django

unread,
Mar 23, 2013, 7:31:01 AM3/23/13
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: new

Component: contrib.formtools | Version: master
Severity: Normal | Resolution:
Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

Comment (by steph):

Changing the revalidation and making the last step a special case isn't a
good idea. Think about a case when someone want's to add a captcha in the
first step.. this would break too.

What do you think about a list of "don't revalidate" forms/steps? This
would give people a way to mark specific steps as "validating once is
fine, skip this form when revalidating everything for the done method".

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:13>

Django

unread,
Jul 3, 2014, 7:14:38 AM7/3/14
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: new
Component: contrib.formtools | Version: master
Severity: Normal | Resolution:
Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------

Comment (by lucalenardi):

I'm experiencing the same issue, involving a re-captcha field validated
'''more than once'''. Using Django 1.6.5.

I agree with steph that hacking around the last step isn't a good idea and
it should be something related to any single step or even to specific
fields (mark a step or a field to not being re-validated).

I would also like to note that the {{{form}}} parameter passed to
{{{render_done()}}} is actually the last step '''already validated''', so
as a temporary fix it should be possible to skip the test and store
{{{form}}} in the {{{final_form}}} dictionary as is. But, is this the
expected behaviour?

{{{


if form_key != self.steps.last and not form_obj.is_valid():

return self.render_revalidation_failure(form_key,
form_obj, **kwargs)
elif form_key == self.steps.last:
# the passed form object, is the last step of the wizard
# and at this point has been already validated.
form_obj = form
final_forms[form_key] = form_obj
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:14>

Django

unread,
Oct 20, 2014, 2:06:09 PM10/20/14
to django-...@googlegroups.com
#10810: FormWizard validates the last form twice
-----------------------------------+------------------------------------
Reporter: Qrilka | Owner: nobody
Type: Bug | Status: closed
Component: contrib.formtools | Version: master
Severity: Normal | Resolution: fixed

Keywords: wizard validation | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-----------------------------------+------------------------------------
Changes (by gchp):

* status: new => closed

* resolution: => fixed


Comment:

formtools has been extracted into its own repository
(​​https://github.com/django/django-formtools/). Because of this, the
issue tracking for this package has been moved to GitHub issues. I'm going
to close this ticket, but I've created a GitHub issue to replace it where
the conversation can continue: ​​https://github.com/django/django-
formtools/issues/21. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/10810#comment:15>

Reply all
Reply to author
Forward
0 new messages