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.8.0.tar.gz (13.1 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.8.0-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_cpf_cnpj2-1.8.0.tar.gz
  • Upload date:
  • Size: 13.1 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.8.0.tar.gz
Algorithm Hash digest
SHA256 3e0152978ea8a77fa5fc4eb8168bb7a93dddc3a5480cc3c6f6278ce0c85e897e
MD5 f21a1d974b0de22192b23b9638b25cbf
BLAKE2b-256 7e7c0f0d8f28ac5969c827b086ca841de958d2bd83affad610afbd96ac2bb19d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_cpf_cnpj2-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 293c4ef847daba3ae277b2f550dcb1f47a2e920d62c37aa34429517748cd3928
MD5 b537d08ad47efd4c44d2f87ad2b6dbb7
BLAKE2b-256 c20bcc27215ecae909453ae060ac076cc81c2e0773dc39edcdb25e564718bd70

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