AndrejZbin / django-hcaptcha

Django hCaptcha provides a simple way to protect your django forms using hCaptcha
BSD 3-Clause "New" or "Revised" License
32 stars 11 forks source link

TemplateDoesNotExist - hcaptcha_widget.html #7

Open nikson07 opened 2 years ago

nikson07 commented 2 years ago

W'z up bro. I tired to make a custom tag to inherit hcaptcha form. But got an error.

Django tried loading these templates, in this order:

django.template.loaders.filesystem.Loader: C:\Users\nikita\Desktop\engine\venv\lib\site-packages\django\forms\templates\hcaptcha_widget.html (Source does not exist)

django.template.loaders.app_directories.Loader: C:\Users\nikita\Desktop\engine\venv\lib\site-packages\django\contrib\admin\templates\hcaptcha_widget.html (Source does not exist)

django.template.loaders.app_directories.Loader: C:\Users\nikita\Desktop\engine\venv\lib\site-packages\django\contrib\auth\templates\hcaptcha_widget.html (Source does not exist)

django.template.loaders.app_directories.Loader: C:\Users\nikita\Desktop\engine\engine\applications\core\templates\hcaptcha_widget.html (Source does not exist)

django.template.loaders.app_directories.Loader: C:\Users\nikita\Desktop\engine\venv\lib\site-packages\allauth\templates\hcaptcha_widget.html (Source does not exist)

...

Django tried to find this html widget, but it was already in template folder, but still can't see it.

nikson07 commented 2 years ago

I am using Allauth package, and it tried to nest a hcaptcha form with another form.

forms.py
class CaptchaForm(forms.Form):
    hcaptcha = hCaptchaField()
customtag.py
@register.simple_tag()
def get_hcaptcha_form():
    return CaptchaForm
In signup form html im using this <div>
<div class="h-captcha d-flex justify-content-center" data-sitekey="{{ site_key }}" style="margin-bottom: 15px"></div>