Template Tags

We provide a few template tags to make it easier to render captcha challenges as well as manually render your own challenge.

get_sitekey()

Returns the site key for the currently active provider.

get_challenge_class()

Returns the css class name for the currently active provider.

This is used to automatically bind challenges to HTML elements.

get_callback_name()

Return the Javascript callback function name for the currently active provider.

render_challenge(challenge_type=”visible”, text=”submit”, js_callback=[RECAPTCHA_JS_CALLBACK|HCAPTCHA_JS_CALLBACK], theme=”light”, size=”normal”)

Renders the challenge as follows:

  • Visible challenges (example, Checkbox) as renders as divs.

  • Invisible challenges are rendered as buttons.

The text arguments specifies the text to use for buttons.

Invisible challenges need a Javascript callback function. By default, this is set to either RECAPTCHA_JS_CALLBACK or HCAPTCHA_JS_CALLBACK. The default callback provided will submit the form.

You can override the kind of HTML generated by creating a template called challenge.html in the allcaptcha directory inside your global templates directory.