Skip to main content

A django model and form field for normalised cpf and cnpj.

Project description

A Django library for working with cpf and cnpj fields.

Installation

Install from pypi:

pip install django-cpf-cnpj2

Install from git:

pip install git+https://github.com/elyasha/django-cpf-cnpj2.git

Basic usage

Add the django_cpf_cnpj app between your apps and django apps:

INSTALLED_APPS = [
    ...
    'django_cpf_cnpj',
    ...
]

Then, you can use it like any regular model field:

from django_cpf_cnpj.fields import CPFField, CNPJField
from django.db import models

class MyModel(models.Model):
    cpf = CPFField(masked=True)  # To enable auto-mask xxx.xxx.xxx-xx
    cnpj = CNPJField(masked=False)  # To disable auto-mask xx.xxx.xxx/xxxx-xx

Running tests

Check tests with tox:

tox

Check a specific combination:

tox -e py38-django22

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_cpf_cnpj2-1.7.0.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_cpf_cnpj2-1.7.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file django_cpf_cnpj2-1.7.0.tar.gz.

File metadata

  • Download URL: django_cpf_cnpj2-1.7.0.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for django_cpf_cnpj2-1.7.0.tar.gz
Algorithm Hash digest
SHA256 198ce253cc02dc53d3b4ddce032ee53e8f035b01b32ad86fa967e50b449836ba
MD5 13f181c9f8660fc989dda40c1957a0e8
BLAKE2b-256 a0b06da4105dc5624e2fa6856dc41568dadab5b3ce2145435a58e9ab95ec7639

See more details on using hashes here.

File details

Details for the file django_cpf_cnpj2-1.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_cpf_cnpj2-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0e7b506735de4daa09f6820a5dca4615f2d492b2830381e0407c70d81fbfe4dd
MD5 3085377711357ac704a4556dd40aa6ef
BLAKE2b-256 1662b8613ceccef81fa37d9465da09096bae12172e8a8869e6efad02431e80ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page