CNPJField (pt-br)
Campo validador de CNPJ para django>3.0
- Não valida perante a RFB.
- Válida independente da máscara aplicada
- Não salva com máscara no banco de dados
Como instalar:
PIP
pip install django-cnpjfield
Django settings
INSTALLED_APPS = [
...
'cnpj_field',
]
Model django
É permitido incluir argumentos regulares (blank, null, e etc) de Fields no CNPJField.
from django.db import models
from cnpj_field.models import CNPJField
class MyModel(models.Model):
...
cnpj = CNPJField()
Requisitos
- Django>=3.0
- Python 3.8
CNPJ inválido e válido
CNPJ inválido e todo e qualquer CNPJ que não contiver dígitos verificadores válidos ou não tenha o tamanho de um CNPJ (max_lenght = 14).
CNPJ válido é todo aquele que conter os dois últimos dígitos verificadores confirmados e possuir tamanho de 14 caracteres. O ALGORITMO NÃO VÁLIDA PERANTE A RECEITA FEDERAL
Agradecimentos
Agradeço ao gabrielloliveira por disponibilizar o seu CPFField, cujo qual utilizei como base na criação desse algoritmo.
Metadata
Release files for django-CNPJField 1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-CNPJField-1.tar.gz | 3.2 kB | Without provenance | Details for django-CNPJField-1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_CNPJField-1-py3-none-any.whl | Python 3 | none | any | Details for django_CNPJField-1-py3-none-any.whl |
Total release size: 7.8 kB
Release files / django-CNPJField-1.tar.gz
| Download URL | django-CNPJField-1.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6d028983469a5a252147c3f81165bfe0c774f3b4f0164556f7741434d7f33e5
|
|
BLAKE2b-256 checksum How to use checksums |
195cce2905e56ebd693aa87e505b982311e80382fb9687ba1d564a8d3b872f56
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
|
Release files / django_CNPJField-1-py3-none-any.whl
| Download URL | django_CNPJField-1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fa8297e5976ecdd6afa582524463d3906e551a149a12eeb1e1a6e49a952e4102
|
|
BLAKE2b-256 checksum How to use checksums |
f0ec80dd4500a24968db87f91aff97b24a6dbd1d750a7a0f4b40075cde4e6e0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.8.3
|
Security for django-CNPJField 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.