I'm using Django 1.6 with mongoengine.
I just started to try the simple captcha but I have the following error.
As it is said in http://django-simple-captcha.readthedocs.org/en/latest/usage.html
I installed in my env, added to Installed apps, I didn't run syncdb because I work with MongoDB and this is not necessary and finally I added the url(r'^captcha/', include('captcha.urls')), into my url app file.
My form.py looks like :
from django import forms
from captcha.fields import CaptchaField
class PostForm(forms.Form):
user = forms.CharField(max_length=256)
password = forms.CharField(widget=forms.PasswordInput)
email = forms.CharField(max_length=256)
captcha = CaptchaField()
And my view:
def post_form_upload(request):
if request.method == 'GET':
form = PostForm()
else:
# A POST request: Handle Form Upload
form = PostForm(request.POST) # Bind data from request.POST into a PostForm
# If data is valid, proceeds to create a new post and redirect the user
if form.is_valid():
user = form.cleaned_data['user']
password = form.cleaned_data['password']
email = form.cleaned_data['email']
connect('reborn')
User.create_user(user,password,email)
#return HttpResponse("Usuari nou creat")
return render(request, 'game/welcomeuser.html', {
'user': user,
})
return render(request, 'game/post_form_upload.html', {
'form': form,
})
So when the form is rendered it gaves me this error :
AttributeError at /game/form_upload.html
'DatabaseWrapper' object has no attribute 'Database'
In template /.../post_form_upload.html, error at line 2
'DatabaseWrapper' object has no attribute 'Database'
1 <form action='/game/form_upload.html' method='post'>{% csrf_token %}
2 {{ form.as_p }} <- HERE
3 <input type='submit' value='Submit' />
4 </form>
5
What's wrong with form.as_p ? Without this captcha runned fine.