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.6.0.tar.gz (12.8 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.6.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_cpf_cnpj2-1.6.0.tar.gz
  • Upload date:
  • Size: 12.8 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.6.0.tar.gz
Algorithm Hash digest
SHA256 cb4f5cd17e281b07d943f2d09f3c914568336ddda51301fc6f8913f5fefec8ac
MD5 abf2a048184b54fd5e05a2d71c9db2e7
BLAKE2b-256 a0fa10022cc313a3cda6cfac3531a5638ef99c055c1b04b096177319ddc902b3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for django_cpf_cnpj2-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b597585ee72d5003da7ebd2efb6b64075073700ee005089cb522183c3888b7cb
MD5 9b840661c48a2beefb6b327a47cf1a92
BLAKE2b-256 d583e37faa8a0c26125b603f312ec631fcdca17fd8097c61aabb6e5e8de6bb47

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