Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
django-simple-math-captcha
Advanced tools
Current Version: 2.0.1
For Django 4, use 2.0.x. For Django < 4, use 1.1.0
A multi-value-field that presents a human answerable question, with no settings.py configuration necessary, but instead can be configured with arguments to the field constructor.
You can do any of the following to install django-simple-math-captcha
pip install django-simple-math-captcha
.setup.py
.simplemathcaptcha
directory on your PYTHONPATH
.Add simplemathcaptcha
to your INSTALLED_APPS in django settings
To add the captcha field to your form:
.. code-block:: python
from django import forms
from simplemathcaptcha.fields import MathCaptchaField
class MyForm(forms.Form):
some_text_field = models.CharField(max_length=50)
captcha = MathCaptchaField()
Optionally, you can pass in the following arguments to the field to configure it.
start_int
The number at which the field should begin its range of random numbers.
This value will be used passed into the creation of a
simplemathcaptcha.widgets.MathCaptchaWidget
for this field.
Default value: ``1``
end_int
The number at which the field should end its range of random numbers.
This value will be used passed into the creation of an
simplemathcaptcha.widgets.MathCaptchaWidget
for this field.
Default value: ``10``
error_messages
A dictionary of error messages. The keys you can use are invalid
and invalid_number
.
invalid
is the message to display when the provided answer is incorrect
Default value: ``"Check your math and try again."``
invalid_number
is the message to display when the entry is not a whole
number
Default value: ``"Enter a whole number."``
question_tmpl A string with format placeholders to use for the displayed question.
Default value: ``"What is %(num1)i %(operator)s %(num2)i?"``
question_class A css class to use for the span containing the displayed question.
Default value: ``"captcha-question"``
widget
The widget instance to use, instead of the field creating an instance
of simplemathcaptcha.widgets.MathCaptchaWidget
. When provided,
it must be an instatiated widget, not a widget class.
Additionally, when specifying ``widget``, you must not specify
``start_int`` or ``end_int``.
Default value: ``None``
Other math captcha fields can present questions that require decimal answers, answers that could be negative values and that require settings.py configuration. This project aims to provide a single field with minimal or no configuration necessary and reduce or prevent spam form submissions.
django-simple-math-captcha is currently used in production.
For any version of Django that doesn't support Python 3, use django-simple-math-captcha 1.0.9 or below, otherwise use 1.1.0 or above.
The django-simple-math-captcha app is released under the Apache Public License v2.
FAQs
An easy-to-use math field/widget captcha for Django forms.
We found that django-simple-math-captcha demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.