elyasha / django-cpf-cnpj2

Simples pacote para campos de CPF e CNPJ

Home Page:https://pypi.org/project/django-cpf-cnpj2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-cpf-cnpf2

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

About

Simples pacote para campos de CPF e CNPJ

https://pypi.org/project/django-cpf-cnpj2/

License:MIT License


Languages

Language:Python 100.0%