Skip to main content

Coral Decimal Mask

Widgets que aplicam mascaras nos forms do django.

Instalação

python -m pip install coral-decimal-mask

Como usar

Adicione decimal_mask em INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "decimal_mask",
]

Configure seus widgets:

from django import forms
from decimal_mask.widgets import DecimalMaskWidget, MoneyMaskWidget, PercentMaskWidget


class MyForm(forms.Form):
    value1 = forms.DecimalField(widget=DecimalMaskWidget())
    value2 = forms.DecimalField(
        widget=DecimalMaskWidget(
            decimal_attrs={
                "locales": "pt-BR",
                "decimalPlaces": 2,
                "format": {
                    "style": "currency",
                    "currency": "BRL",
                },
            },
        ),
    ) # ou usar forms.DecimalField(widget=MoneyMaskWidget())
    value3 = forms.DecimalField(widget=PercentMaskWidget())
  • O parâmetro decimal_attrs são algumas opções para construir o objeto javascript Intl.NumberFormat.

    • locales é o primeiro parâmetro de Intl.NumberFormat referente a linguagem utilizada na interface do usuário da sua aplicação.

    • decimalPlaces é o número de casas decimais que a mascara vai considerar.

    • format é um dict com as informações do parâmetro options de Intl.NumberFormat.

Contribuindo com o projeto

(venv) poetry install
(venv) pytest

Metadata

Release files for coral-decimal-mask 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for coral-decimal-mask 0.4.1
File Size Uploaded Provenance Actions
coral_decimal_mask-0.4.1.tar.gz 3.9 kB Without provenance Details for coral_decimal_mask-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for coral-decimal-mask 0.4.1
File Interpreter ABI Platform Actions
coral_decimal_mask-0.4.1-py3-none-any.whl Python 3 none any Details for coral_decimal_mask-0.4.1-py3-none-any.whl

Total release size: 8.7 kB

Release files / coral_decimal_mask-0.4.1.tar.gz

Download URL coral_decimal_mask-0.4.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4488347b1d9d66f02e50708ec81ea928fc13c13bd775da1ac1f54219d27c802e
BLAKE2b-256 checksum
How to use checksums
0446d526de4212f568d041c60300793769d653c01796590e12b12d309643512a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.1 Linux/6.4.15-200.fc38.x86_64

Release files / coral_decimal_mask-0.4.1-py3-none-any.whl

Download URL coral_decimal_mask-0.4.1-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9fa89c2ea89c1760cc2f396f8ad3a90e6888762fc5d7fae0b7bc975372fae3e
BLAKE2b-256 checksum
How to use checksums
5c0b9bfdd12fed85f5c88f20446eb8b026fa119fb63658b1f68f76a532198388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.5.1 CPython/3.11.1 Linux/6.4.15-200.fc38.x86_64

Security for coral-decimal-mask 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page