Validador de CNPJ para Django
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-CNPJField-1.tar.gz.
File metadata
- Download URL: django-CNPJField-1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6d028983469a5a252147c3f81165bfe0c774f3b4f0164556f7741434d7f33e5
|
|
| MD5 |
00b084fcee276546ea90fe188d71b1ea
|
|
| BLAKE2b-256 |
195cce2905e56ebd693aa87e505b982311e80382fb9687ba1d564a8d3b872f56
|
File details
Details for the file django_CNPJField-1-py3-none-any.whl.
File metadata
- Download URL: django_CNPJField-1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa8297e5976ecdd6afa582524463d3906e551a149a12eeb1e1a6e49a952e4102
|
|
| MD5 |
fb09424417ab0088c46f6478b0bffe24
|
|
| BLAKE2b-256 |
f0ec80dd4500a24968db87f91aff97b24a6dbd1d750a7a0f4b40075cde4e6e0a
|