We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello! Why do you take a custom template from the arguments, but render the template from the settings anyway?
class CaptchaTextInput(BaseCaptchaTextInput): def __init__(self, attrs=None, **kwargs): self._args = kwargs self._args['field_template'] = self._args.get('field_template') or settings.CAPTCHA_FIELD_TEMPLATE def format_output(self, rendered_widgets): hidden_field, text_field = rendered_widgets # <---- Unused variables if self._args['output_format']: return self._args['output_format'] % {...} elif self._args['field_template']: context = { 'image': mark_safe(self.image_and_audio), 'hidden_field': mark_safe(self.hidden_field), 'text_field': mark_safe(self.text_field) } return render_to_string(settings.CAPTCHA_FIELD_TEMPLATE, context) # <---- This line
In addition, it would also be nice to take from the arguments.
def render(self, name, value, attrs=None): self.fetch_captcha_store(name, value, attrs, self._args.get('generator')) context = {...} if settings.CAPTCHA_FLITE_PATH: # <-------- self._args context.update({'audio': self.audio_url()}) self.image_and_audio = render_to_string(settings.CAPTCHA_IMAGE_TEMPLATE, context) # <-------- self._args self.hidden_field = render_to_string(settings.CAPTCHA_HIDDEN_FIELD_TEMPLATE, context) # <-------- self._args self.text_field = render_to_string(settings.CAPTCHA_TEXT_FIELD_TEMPLATE, context) # <-------- self._args return super(CaptchaTextInput, self).render(name, self._value, attrs=attrs)
This will not allow you to bind all the captcha in the project to the same settings.
The text was updated successfully, but these errors were encountered:
field_template fixed in #139.
field_template
Sorry, something went wrong.
_args removed in #133.
_args
No branches or pull requests
Hello!
Why do you take a custom template from the arguments, but render the template from the settings anyway?
In addition, it would also be nice to take from the arguments.
This will not allow you to bind all the captcha in the project to the same settings.
The text was updated successfully, but these errors were encountered: