X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=forms.py;h=1f10f13c543e7f966507bf52cd5cfee2ba54c34c;hb=f95c6edd7cd2847deebc5a2a6bfce243eca43481;hp=f89c3c76f55d5d6bf5520353268f15c52d92d031;hpb=39eca015d1943265b6d3cef73e8ed631a48439a4;p=cascardo%2Feventmanager.git diff --git a/forms.py b/forms.py index f89c3c7..1f10f13 100644 --- a/forms.py +++ b/forms.py @@ -142,6 +142,15 @@ class InscricaoBase(LoginBase): class Inscricao(InscricaoBase): inscricao_comercial = forms.BooleanField(required=False, label='Inscrição Comercial') + cpf_cnpj = forms.CharField(max_length=20, required=False, label='CPF/CNPJ', + help_text='Somente necessário para a inscrição comercial') + + def clean_cpf_cnpj(self): + cpf_cnpj = self.cleaned_data['cpf_cnpj'] + if self.cleaned_data['inscricao_comercial'] and not cpf_cnpj: + raise ValidationError('Você escolheu a inscrição comercial, ' + 'portanto este campo se torna obrigatório') + return cpf_cnpj class InscricaoCaravana(InscricaoBase): lista_nomes = forms.CharField(label='Lista de nomes',