Skip to main content

A Django library for working with cpf and cnpj fields.

Installation

Install from pypi:

pip install django-cpf-cnpj

Install from git:

pip install git+https://github.com/flavianogjc/django-cpf-cnpj.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

Metadata

Release files for django-cpf-cnpj 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for django-cpf-cnpj 1.0.0
File Interpreter ABI Platform
django_cpf_cnpj-1.0.0-py3-none-any.whl Python 3 none any Details

Release files / django_cpf_cnpj-1.0.0-py3-none-any.whl

Download URL django_cpf_cnpj-1.0.0-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e3400b8181d9f4dd99ebd5d3c2d127d1180cb9a4e5448145f6904629c61ad12
BLAKE2b-256 checksum
How to use checksums
e1b787684f5bddea216868e834034746cdd7d7bc3c65c86044a9ebb0943fe0a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page