ojengwa / django-simple-captcha

Automatically exported from code.google.com/p/django-simple-captcha
MIT License
1 stars 0 forks source link

It will be nice to use widget parameter instead of settings.CAPTCHA_IMAGE_BEFORE_FIELD #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
At least for me it would be more convenient to set representation
properties of CaptchaField by defining widget's initialization parameters
rather then modifying global settings.py file.

I suggest to use attrs dictionary... namely
--- captcha/fields.py   (revision 34)
+++ captcha/fields.py   (working copy)
@@ -33,7 +33,7 @@
         if settings.CAPTCHA_FLITE_PATH:
             ret = '<a href="%s" title="%s">%s</a>' %(
reverse('captcha-audio', kwargs=dict(key=key)), unicode(_('Play captcha as
audio file')), ret)

-        if settings.CAPTCHA_IMAGE_BEFORE_FIELD:
+        if 'IMAGE_BEFORE_FIELD' in self.attrs:
             return mark_safe(ret + super(CaptchaTextInput,
self).render(name, value, attrs=attrs))
         else:
             return mark_safe(super(CaptchaTextInput, self).render(name,
value, attrs=attrs)+ret)

Original issue reported on code.google.com by fedor.ty...@gmail.com on 20 Jul 2009 at 9:41

GoogleCodeExporter commented 9 years ago
I'd say this was covered in Issue 33 (and fixed in r55).

Original comment by mbonetti on 11 Jul 2010 at 11:20