Created
May 17, 2021 14:30
-
-
Save fandrefh/9fb597910a7598f3a26f72cc37138ddd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from django.contrib.auth import get_user_model | |
| from django.utils.translation import ugettext_lazy as _ | |
| from baseapp.models import AbstractDateTimeBaseModel | |
| from localflavor.br.br_states import STATE_CHOICES | |
| # Create your models here. | |
| User = get_user_model() | |
| class Profile(AbstractDateTimeBaseModel): | |
| EMITTING_ORGAN_CHOICES = ( | |
| (1, 'SSP'), | |
| (2, 'Organismos Militares'), | |
| (3, 'Comando da Aeronáutica (Ex Ministério da Aeronáutica)'), | |
| (4, 'Comando do ExÈrcito (Ex Ministério do Exército)'), | |
| (5, 'Comando da Marinha (Ex Ministério da Marinha)'), | |
| (6, 'Polícia Federal'), | |
| (7, 'Carteira de Identidade Classista'), | |
| (8, 'Conselho Regional de Administração'), | |
| (9, 'Conselho Regional de Assist. Social'), | |
| (10, 'Conselho Regional de Biblioteconomia'), | |
| (11, 'Conselho Regional de Contabilidade'), | |
| (12, 'Conselho Regional de Corretores Imóveis'), | |
| (13, 'Conselho Regional de Enfermagem'), | |
| (14, 'Conselho Regional de Engenharia, Arquitetura e Agronomia'), | |
| (15, 'Conselho Regional de Estatística'), | |
| (16, 'Conselho Regional de Farmácia'), | |
| (17, 'Conselho Regional de Fisioterapia e Terapia Ocupacional'), | |
| (18, 'Conselho Regional de Medicina'), | |
| (19, 'Conselho Regional de Medicina Veterinária'), | |
| (20, 'Ordem dos Músicos do Brasil'), | |
| (21, 'Conselho Regional de Nutrição'), | |
| (22, 'Conselho Regional de Odontologia'), | |
| (23, 'Conselho Regional de Profissionais de Relações Públicas'), | |
| (24, 'Conselho Regional de Psicologia'), | |
| (25, 'Conselho Regional de Química'), | |
| (26, 'Conselho Regional de Representantes Comerciais'), | |
| (27, 'Ordem dos Advogados do Brasil'), | |
| (28, 'Outros Emissores'), | |
| (29, 'Documento Estrangeiro'), | |
| ) | |
| user = models.OneToOneField(User, verbose_name=_('Usuário'), related_name='profile', on_delete=models.CASCADE) | |
| brazilian_cpf = models.CharField(verbose_name=_('CPF'), max_length=14, unique=True) | |
| brazilian_rg = models.CharField(verbose_name=_('RG/Identidade'), max_length=50, blank=True, null=True, unique=True) | |
| emitting_organ = models.PositiveIntegerField(verbose_name=_('Orgão emissor'), | |
| choices=EMITTING_ORGAN_CHOICES, blank=True, null=True) | |
| birthday = models.DateField(verbose_name=_('Nascimento'), blank=True, null=True) | |
| address = models.CharField(verbose_name=_('Endereço'), max_length=200, blank=True, default='') | |
| number = models.CharField(verbose_name=_('Número/APTO'), max_length=20, blank=True, default='') | |
| city = models.CharField(verbose_name=_('Cidade'), max_length=100, blank=True, default='') | |
| state = models.CharField(verbose_name=_('Estado'), max_length=2, choices=STATE_CHOICES, blank=True, default='') | |
| zip_code = models.CharField(verbose_name=_('CEP'), max_length=10, blank=True, default='') | |
| complement = models.CharField(verbose_name=_('Complemento'), max_length=150, blank=True, default='') | |
| cell_phone = models.CharField(verbose_name=_('Celular'), max_length=14, blank=True, null=True, unique=True) | |
| photo = models.ImageField(verbose_name=_('Foto'), upload_to='photos', blank=True, null=True) | |
| class Meta: | |
| verbose_name = _('Perfil') | |
| verbose_name_plural = _('Perfis') | |
| def __str__(self): | |
| return self.user.get_full_name() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment