Hi,
I'm currently trying to implement django simple captcha on my form. It's
quite straight forward to set up with the "out of the box" django form
functionality - just add a captcha field to the form in forms.py, and in
the template, use the built in django form template like this:
{% form.as_ul %}
And this dynamically generates the HTML for all my form fields including
the captcha field:
<label for="id_captcha_1">Captcha:</label>
<img class="captcha" alt="captcha"
src="/captcha/image/7114a37ed0f72ec3105510e0f5c73128a2f95649/">
<input id="id_captcha_0" type="hidden"
value="7114a37ed0f72ec3105510e0f5c73128a2f95649" name="captcha_0">
<input id="id_captcha_1" type="text" name="captcha_1">
My issue is that I can't use {% form.as_ul %} to display my form, because
each field requires customised css styling.
So I'll need to replace the {% form.as_ul %} with the actual HTML code in
my template.
This works fine, however, the captcha field value needs to be re-generated
each time, so I need to generate the captcha field value dynamically each
time the form is loaded.
What is the best way to do this? I guess I'm looking for something similar
to the way the csrf token works, ie. the {% csrf_token %} tag, which
dynamically generates the csrf token. Is there an equivalient for simple
captcha, like {% captcha_value %} or something?
thanks in advance,
Mark
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.