-
Notifications
You must be signed in to change notification settings - Fork 324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom template: key for retrieving hashkey value #237
Comments
See Context, one paragraph down in the linked documentation. Is this what you're looking for? |
Perhaps I'm not understanding the Context environment so well, but I tried using Creating a new key from my view function and passing that in the context, was not accessible to the template. As I say I might be misunderstanding something. Just to explain: my app function "contact_view()" is rendering an app template called "contact_page.html" which includes the captcha form "custom_captcha_template.html". Somehow, context is visible to the "contact_page.html" but is not being rendered by the custom template. |
The custom_captcha_template.html template included from your parent template doesn't get the context from the form rendering, only the form rendering itself does! You want to define a form, which includes a CaptchaField, as described in the docs class CustomCaptchaTextInput(CaptchaTextInput):
template_name = 'custom_field.html'
class CaptchaForm(forms.Form):
captcha = CaptchaField(widget=CustomCaptchaTextInput) Then from either of your templates you render the form, e.g. |
Thank you. Your explanation is logical and that is how I understand after reading the docs. I'll check my implementation again. |
I've created a custom template as described in the docs at Rendering.
As per the code example I am able to populate the image_url with
{{ image }}
:Which key do I use to populate the hidden input value (hashkey) of "id_captcha_0" in the following?
The text was updated successfully, but these errors were encountered: