Open GoogleCodeExporter opened 8 years ago
I've never used the formwizard contrib, but will definitely give it a try and
see how
I can fix DSC to work with it, though.
Original comment by mbonetti
on 27 Apr 2009 at 2:31
Actually I'm not sure if the problem is in captcha itself. I've filed a ticket -
http://code.djangoproject.com/ticket/10810 but the solution proposed is a
work-around
and I haven't found how to combine "one-way" fields with formwizard. It looks
like
conflicting requirements (revalidation in formwizard and single validation in
captcha)
Original comment by qri...@gmail.com
on 27 Apr 2009 at 2:38
A quick-fix would probably be to comment-out the store.delete() line on line 58
of
fields.py, and configure a large-enough CAPTCHA_TIMEOUT period, so that the
captcha
can be validated an unlimited numbed of times, during the validity period.
Original comment by mbonetti
on 27 Apr 2009 at 2:48
Of course, but I don't think it's the right way to do it...
Original comment by qri...@gmail.com
on 27 Apr 2009 at 3:56
My approach was to inherit my own FormWizard class from the one provided
in django.contrib.formtools.
My derived class implements its own __call__() method, which is basicaly
cut'n'pasted
from django with small difference, see following patch:
--- /tmp/modified.py 2011-02-03 01:10:20.000000000 +0100
+++ /tmp/original.py 2011-02-03 01:11:16.000000000 +0100
@@ -41,7 +41,7 @@
# must mean the validator relied on some other input, such as
# an external Web site.
for i, f in enumerate(final_form_list):
- if not f.is_valid() and not self.has_captcha_field(f):
+ if not f.is_valid():
return self.render_revalidation_failure(request, i, f)
return self.done(request, final_form_list)
@@ -51,4 +51,3 @@
self.step = current_step = next_step
return self.render(form, request, current_step)
the derived class also implements a static method has_captcha_field(),
which looks as follows:
@staticmethod
def has_captcha_field(form):
for f in form.fields:
if type(form[f].field) == type(CaptchaField()):
return True
return False
it works for me pretty well.
Original comment by anedvedi...@gmail.com
on 3 Feb 2011 at 12:16
My workaround has been call "storage.delete()" at the method "__delete__" of
the field class, this way the field can be cleaned more than once in the
context of the same instance and not in multiple requests.
Original comment by anle...@gmail.com
on 1 Apr 2011 at 11:23
Attachments:
Original issue reported on code.google.com by
qri...@gmail.com
on 5 Apr 2009 at 8:44