jrsouza95 / drf-cpfcnpj-validator

A small and quick validation plugin for CPF and CNPJ in django rest framework!
MIT License
3 stars 0 forks source link
cnpj cpf django django-rest-framework drf drf-cnpj-validation drf-cpf-validation drf-validation library plugin python validacao-de-cnpj validacao-de-cpf validation validation-library validation-plugin validator validators

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 _LANGUAGECODE , located in settings.py.