Hello!

I want to use captcha protection for any app, and I do:

### urls.py
    (r'^captcha/', include('anastas.apps.captcha.urls')),

### anastas.apps.articles.urls.py 
    (r'^create/$', 'anastas.apps.captcha.views.verify',
dict(forward_to='anastas.apps.a rticles.views.create_article')),

### anastas.apps.articles.views.py
def create_article(request, captcha_error):
    manipulator = Article.AddManipulator()
    if not request.user.is_anonymous():
        if request.POST:
            new_data = request.POST.copy()
            new_data['author'] = str(request.user.id)
            new_data['publish'] = '0'
            errors = manipulator.get_validation_errors(new_data)
            if captcha_error:
                errors['captcha_word'] = captcha_error
            if not errors:
                manipulator.do_html2python(new_data)
                manipulator.save(new_data)
                return HttpResponseRedirect("/news/")
        else:
            errors = new_data = {}

        form = forms.FormWrapper(manipulator, new_data, errors)
        return render_to_response('articles/article_form.html', {
            'form': form,
        }, context_instance=RequestContext(request))

### temlate
{% load captcha %}
{% captcha %}
<form method="POST" action="."><table class="edit_forms">
[...]
  <tr><td>
    <input type="submit" name="submit" class="click" \>
  </td><td>
    {% trans "Please enter the word you see in the picture" %}<br>
    <input type="text" class="vTextField"
name="{{ captcha_input_name }}"/> <input type="hidden"
name="{{ captcha_hidden_input_name }}" value="{{ captcha_id }}"/> <img
src="{{ captcha_image }}" width=80 height=30 /> </td></tr>
</table>

but all {{ captcha_* }} shows empty:
  <tr><td>
    <input type="submit" name="submit" class="click" \>
  </td><td>
    Please enter the word you see in the picture<br>
    <input type="text" class="vTextField" name=""/>
    <input type="hidden" name="" value=""/>
    <img src="" width=80 height=30 />                       
  </td></tr>

Why it can be, and how to fix it?

Thanks.

-- 
÷ÓÅÇÏ ÎÁÉÌÕÞÛÅÇÏ! çÒÉÇÏÒÉÊ
greg [at] anastasia [dot] ru
ðÉÓØÍÏ ÏÔÐÒÁ×ÌÅÎÏ: 2006/10/30 20:57

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to