Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

A small and quick validation plugin for CPF and CNPJ in django rest framework!

License

Notifications You must be signed in to change notification settings

jrsouza95/drf-cpfcnpj-validator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DJANGO REST CNPJ OR CPF VALIDATOR

A small and quick validation plugin for CPF or CNPJ in django rest framework!

Install:

sudo pip install drf_cpf_cnpj_validator

Examples:

from rest_framework import serializers 
from drf_cpf_cnpj_validator.validadors import cpf_validator, cnpj_validator


class PersonSerializer(serializers.ModelSerializer):
    cpf = serializers.Charfield(validators=[cpf_validator])


class CompanySerializer(serializers.ModelSerializer):
    cnpj = serializers.Charfield(validators=[cnpj_validator])

Translations:

This plugin translate the messages from your LANGUAGE_CODE , located in settings.py.

  • Enabled translations:

    • en-US
    • pt-BR
    • es-ES