Пример #1
0
class Order(TimeStampedModel):
    cpf = BRCPFField("CPF")
    name = models.CharField("Nome Completo", max_length=250)
    email = models.EmailField()
    postal_code = BRPostalCodeField("CEP")
    address = models.CharField("Endereço", max_length=250)
    number = models.CharField("Número", max_length=250)
    complement = models.CharField("Complemento", max_length=250, blank=True)
    district = models.CharField("Bairro", max_length=250)
    state = BRStateField("Estado")
    city = models.CharField("Cidade", max_length=250)
    paid = models.BooleanField(default=False)

    class Meta:
        ordering = ("-created",)
  
    def __str__(self):
        return f"Pedido {self.id}"

    def get_total_price(self):
        total_cost = sum(item.get_total_price() for item in self.items.all())
        return total_cost

    def get_description(self):
        return ", ".join(
            [f"{item.quantity}x {item.product.title}" for item in self.items.all()]
        )
Пример #2
0
class Address(models.Model):
    profile = models.ForeignKey(Profile,
                                verbose_name='Usuário',
                                related_name='address',
                                on_delete=models.CASCADE)
    postalcode = BRPostalCodeField('CEP',
                                   max_length=10,
                                   null=True,
                                   default=None)
    street_name = models.CharField('Endereço',
                                   max_length=255,
                                   null=True,
                                   default=None)
    street_number = models.CharField('Número',
                                     max_length=10,
                                     null=True,
                                     default=None)
    complement = models.CharField('Complemento',
                                  max_length=100,
                                  null=True,
                                  default=None)
    neighborhood = models.CharField('Bairro',
                                    max_length=100,
                                    null=True,
                                    default=None)
    city = models.CharField('Cidade', max_length=100, null=True, default=None)
    state = BRStateField('Estado', max_length=2, null=True, default=None)

    class Meta:
        verbose_name = 'Endereço'
        verbose_name_plural = 'Endereços'
Пример #3
0
class Empresa(models.Model):

    contrato_choice = (
        ('Operadora', 'Operadora'),
        ('Seguradora', 'Seguradora'),
    )
    operadora_choice = (
        ('Saude', 'Saude'),
        ('Odonto', 'Odonto'),
    )

    seguradora_choice = (('Seguro de Vida', 'Seguro de Vida'), )

    CNPJ = BRCNPJField("Número CNPJ", max_length=14, null=False, unique=True)
    cod_empresa = models.CharField("Codigo Empresa",
                                   max_length=25,
                                   null=False,
                                   unique=True)
    vencimento_boleto = models.DateField("Vencimento do Boleto",
                                         auto_now=False,
                                         auto_now_add=False,
                                         null=False)
    data_recebimento = models.DateField("Data Recebimento",
                                        auto_now=False,
                                        auto_now_add=False,
                                        blank=True,
                                        null=False)
    razao_social = models.CharField("Razão Social", max_length=255)
    tipo_contrato = models.CharField(max_length=25, choices=contrato_choice)
    anexo_doc_emp = models.ImageField(upload_to=empresa_path,
                                      blank=True,
                                      null=True)
    inicio_vigencia = models.DateField("Inicio de Vigência",
                                       auto_now=False,
                                       auto_now_add=False,
                                       null=False)
    celular = models.CharField("Numero do Celular", max_length=100, null=True)
    cidade = models.CharField("Cidade",
                              max_length=150,
                              blank=False,
                              null=False)
    estado = BRStateField("Estado UF", max_length=150, blank=False, null=False)
    is_filial = models.BooleanField()
    status = models.CharField("Status",
                              max_length=25,
                              default="OK",
                              editable=False)
    ativo = models.BooleanField(default=True)
    observacoes = models.TextField("Obs.", blank=True, null=True)
    criado_em = models.DateTimeField("criado em", auto_now_add=True)
    atualizado_em = models.DateTimeField("atualizado", auto_now=True)

    def __str__(self):
        return f'{self.razao_social} - CNPJ: {self.CNPJ}'

    class Meta:
        ordering = ['ativo']
Пример #4
0
class Endereco_pacientes(models.Model):
    cod_endereco = models.AutoField(auto_created=True,
                                    primary_key=True,
                                    serialize=False,
                                    verbose_name='COD_ENDEREÇO')
    endereco = models.CharField(max_length=100, blank=False, null=False)
    numero = models.IntegerField(blank=False, null=False)
    bairro = models.CharField(max_length=100, blank=False, null=False)
    complemento = models.CharField(max_length=100, blank=True, null=True)
    cidade = models.CharField(max_length=100, blank=False, null=False)
    estado = BRStateField("Estado", blank=False, null=False)
    cep = BRPostalCodeField("CEP", blank=False, null=False)
Пример #5
0
class Order(TimeStampedModel):
    cpf = BRCPFField("CPF")
    name = models.CharField("Nome Completo", max_length=250)
    email = models.EmailField()
    postal_code = BRPostalCodeField("CEP")
    address = models.CharField("Endereço", max_length=250)
    number = models.CharField("Número", max_length=250)
    complement = models.CharField("Complemento", max_length=250, blank=True)
    district = models.CharField("Bairro", max_length=250)
    state = BRStateField("Estado")
    city = models.CharField("Cidade", max_length=250)
    paid = models.BooleanField(default=False)

    class Meta:
        ordering = ("-created", )

    def __str__(self):
        return f"Pedido {self.id}"
Пример #6
0
class User(AbstractUser):
    """User model customizado. Usa email em vez de username para autenticar"""

    username = models.CharField(
        "Usuário",
        max_length=30,
        unique=True,
        validators=[
            validators.RegexValidator(
                re.compile("^[\w.@+-]+$"),
                "Informe um nome de usuário válido. "
                "Este valor deve conter apenas letras, números "
                "e os caracteres: @/./+/_ .",
                "invalid",
            )
        ],
        help_text=
        "Um nome curto que será usado para identificá-lo de forma única.",
    )
    email = models.EmailField("Email", max_length=150, unique=True)
    cpf = BRCPFField("CPF", blank=True)
    cnpj = BRCNPJField("CNPJ", blank=True)
    postal_code = BRPostalCodeField("CEP", blank=True)
    address = models.CharField("Endereço", max_length=250, blank=True)
    district = models.CharField("Bairro", max_length=250, blank=True)
    state = BRStateField("Estado", blank=True)
    city = models.CharField("Cidade", max_length=250, blank=True)

    created = models.DateTimeField("Criado", auto_now_add=True)
    modified = models.DateTimeField("Modificado", auto_now=True)

    USERNAME_FIELD = "email"
    REQUIRED_FIELDS = ["username"]

    class Meta:
        verbose_name = "Usuário"
        verbose_name_plural = "Usuários"
        ordering = [
            "-created",
        ]

    def _str_(self):
        self.name or self.email
Пример #7
0
class Colaborador(models.Model):

    nome = models.CharField(max_length=60)
    cpf = models.CharField(max_length=11)
    #    cpf = BRCPFField(label='CPF')

    dtNascimento = models.DateField(blank=True,
                                    null=True,
                                    verbose_name='Data de nascimento')
    sexo = models.CharField(max_length=1, choices=SEXO_CHOICES, default='F')
    estado_civil = models.CharField(max_length=1,
                                    choices=ESTADO_CIVIL_CHOICES,
                                    default='C',
                                    verbose_name='Estado civil')
    email = models.EmailField(blank=True, null=True)
    cep = models.CharField(max_length=8, blank=True, null=True)
    #    cep = BRZipCodeField(label='CEP')

    endereco = models.CharField(max_length=60,
                                blank=True,
                                null=True,
                                verbose_name='Endereço')
    nrEndereco = models.CharField(max_length=60,
                                  blank=True,
                                  null=True,
                                  verbose_name='Nº endereço')
    bairro = models.CharField(max_length=60, blank=True, null=True)
    cidade = models.CharField(max_length=60, blank=True, null=True)
    estado = BRStateField(max_length=2, choices=STATE_CHOICES, default='RS')
    nrTelCelular = PhoneNumberField(max_length=11,
                                    blank=True,
                                    null=True,
                                    verbose_name='Nº telefone celular')
    nrTelFixo = PhoneNumberField(max_length=11,
                                 blank=True,
                                 null=True,
                                 verbose_name='Nº telefone fixo')

    class Meta:
        verbose_name_plural = 'Colaboradores'

    def __str__(self):
        return self.nome
Пример #8
0
class User(AbstractUser):
    email = models.EmailField(unique=True, blank=False, null=False)
    first_name = models.CharField(max_length=20, blank=False, null=False)
    last_name = models.CharField(max_length=20, blank=False, null=False)
    data_nascimento = models.DateField(blank=False, null=False)
    sexo = models.CharField(max_length=1,
                            choices=SEXO_CHOICES,
                            blank=False,
                            null=False)
    faculdade = models.CharField(max_length=200, blank=True, null=True)
    periodo = models.CharField(max_length=20, blank=True, null=True, default=0)
    estado_civil = models.CharField(max_length=2,
                                    choices=ESTADO_CIVIL_CHOICES,
                                    null=True,
                                    blank=True)
    telefone = models.CharField(max_length=15, null=True, blank=True)
    endereco = models.CharField(max_length=250, blank=False, null=False)
    numero = models.CharField(max_length=250, blank=False, null=False)
    complemento = models.CharField(max_length=250, blank=False, null=False)
    bairro = models.CharField(max_length=250, blank=False, null=False)
    cidade = models.CharField(max_length=50, null=True, blank=True)
    cep = BRPostalCodeField("CEP", blank=False, null=False)
    cpf = BRCPFField("CPF", blank=False, unique=True, null=False)
    estado = BRStateField("Estado", blank=False, null=False)
Пример #9
0
class Resume(models.Model):
    class civilState(models.TextChoices):
        SINGLE = 'Solteiro(a)', _('Solteiro(a)')
        MARRIED = 'Casado', _('Casado(a)')
        DIVORCED = 'Divorciado(a)', _('Divorciado(a)')
        WIDOW = 'Viúvo(a)', _('Viúvo(a)')

    def is_upperclass(self):
        return self.civil_state in {
            self.civilState.DIVORCED,
            self.civilState.SINGLE,
        }

    class genderChoices(models.TextChoices):
        MALE = 'Masculino', _('Masculino')
        FEMALE = 'Feminino', _('Feminino')
        OTHER = 'Outro', _('Outro')

    class deficiency(models.TextChoices):
        YES = 'Sim', _('Sim')
        NO = 'Não', _('Não')

    class scholarshipLevel(models.TextChoices):
        FUNDAMENTAL_INCOMPLETE = 'Ensino Fundamental Incompleto', _(
            'Ensino Fundamental Completo')
        FUNDAMENTAL_COMPLETE = 'Ensino Fundamental Completo', _(
            'Ensino Fundamental Incompleto')
        HIGHSCHOOL_INCOMPLETE = 'Ensino Médio Incompleto', _(
            'Ensino Médio Incompleto')
        HIGHSCHOOL_COMPLETE = 'Ensino Médio Completo', _(
            'Ensino Médio Completo')
        COLLEGE_INCOMPLETE = 'Ensino Superior Incompleto', _(
            'Ensino Superior Incompleto')
        COLLEGE_COMPLETE = 'Ensino Superior Completo', _(
            'Ensino Superior Completo')

    class formation(models.TextChoices):
        BACHELOR = 'Bacharelado', _('Bacharelado')
        GRADUATION = 'Licenciatura', _('Licenciatura')
        TECHNOLOGIST = 'Tecnólogo', _('Tecnólogo')
        SPECIALIZATION = 'Especialização', _('Especialização')
        MBA = 'MBA', _('MBA')
        MASTERS_DEGREE = 'Mestrado', _('Mestrado')
        DOCTORATE_DEGREE = 'Doutorado', _('Doutorado')
        POST_DOCTORAL = 'Pós-Doutorado', _('Pós-Doutorado')

    resume_id = models.AutoField("ID do Currículo", primary_key=True)

    # Profile Image
    # Necessário configurar o Media Root
    profile_image = models.ImageField(
        "Imagem de Perfil",
        upload_to='pictures/%d/%m/%Y/',
        blank="true",
    )

    # Informações pessoais
    name = models.CharField("Nome Completo", max_length=200)
    birthday = models.DateField("Data de Nascimento")

    civil_state = models.CharField("Estado Civil",
                                   max_length=13,
                                   choices=civilState.choices,
                                   default=civilState.SINGLE)
    nationality = models.CharField("Nacionalidade", max_length=50)

    gender = models.CharField("Gênero",
                              choices=genderChoices.choices,
                              max_length=9)

    # Endereço

    postal_code = BRPostalCodeField("CEP", max_length=9)
    street = models.CharField("Logradouro", max_length=100)
    district = models.CharField("Bairro", max_length=100)
    city = models.CharField("Cidade", max_length=100)
    state = BRStateField("Estado", max_length=50)

    # Contatos

    email = models.EmailField("E-mail")
    telephone = models.CharField("Telefone", max_length=(15), blank=True)
    linkedin = models.URLField("Linkedin", blank=True)
    facebook = models.URLField("Facebook", blank=True)
    instagram = models.URLField("Instagram", blank=True)
    other_social_media = models.URLField("Outra mídia social", blank=True)

    # Sobre mim
    description = models.TextField("Descrição", max_length=500)

    # Pessoa com Deficiência
    deficient_person = models.CharField("Pessoa com deficiência?",
                                        choices=deficiency.choices,
                                        max_length=3)
    if_deficient = models.CharField("Se sim, descreva a deficiência",
                                    max_length=100,
                                    blank=True)

    # Formação Acadêmica
    scholarship_level = models.CharField("Nível de escolaridade",
                                         choices=scholarshipLevel.choices,
                                         max_length=50,
                                         blank=True)

    formation_kind = models.CharField("Tipo de formação",
                                      choices=formation.choices,
                                      max_length=50,
                                      blank=True)
    education_institution = models.CharField("Instituição de Ensino",
                                             max_length=100,
                                             blank=True)
    course = models.CharField("Curso", max_length=50, blank=True)
    start_date = models.DateField("Data de Início", blank=True)
    finish_date = models.DateField("Data de finalização", blank=True)

    # Objetivos Profissionais
    professional_objectives = models.TextField("Objetivos profissionais",
                                               max_length=500)

    # Skills

    skills = models.TextField("Habilidades", max_length=500)

    # Experiência Profissional
    company = models.CharField("Empresa", max_length=50, blank=True)
    role = models.CharField("Cargo", max_length=30, blank=True)
    professional_area = models.CharField("Área profissional",
                                         max_length=30,
                                         blank=True)
    salary = models.DecimalField("Salário",
                                 decimal_places=2,
                                 max_digits=6,
                                 blank=True)
    start_company_date = models.DateField("Data de início", blank=True)
    finish_company_date = models.DateField("Data do Fim (se houver)",
                                           blank=True)
    function_role = models.TextField("Descreva as funções",
                                     max_length=500,
                                     blank=True)

    # Certificações
    certifications = models.TextField("Certificações",
                                      max_length=500,
                                      blank=True)

    # Idiomas
    languages = models.TextField("Linguagens", max_length=500, blank=True)

    # Data de publicação
    published_time = models.DateTimeField("Publicado em: ",
                                          default=datetime.now,
                                          blank=True)

    # Pessoa que publicou
    person = models.ForeignKey(User, on_delete=models.CASCADE)

    def __str__(self):
        return self.name
Пример #10
0
class Parentesco(models.Model):
    objects: None = None
    sexo_choice = (
        ('Masculino', 'Masculino'),
        ('Feminino', 'Feminino'),
    )

    parentesco_choice = (
        ('Filho(a)', 'Filho(a)'),
        ('Conjuge', 'Conjuge'),
    )

    estado_civil_choice = (
        ('Solteiro(a)', 'Solteiro(a)'),
        ('Casado(a)', 'Casado(a)'),
        ('Convivente', 'Convivente'),
    )

    declaracao_saude_choice = (
        ('Sim', 'Sim'),
        ('Nao', 'Nao'),
    )

    nome = models.CharField("Nome Dependente", max_length=255, blank=False)
    CPF = BRCPFField("Número CPF", max_length=14, null=False, unique=True)
    cod_empresa = models.CharField("Codigo Empresa",
                                   max_length=25,
                                   null=True,
                                   blank=True,
                                   validators=[cod_empresa_existe])
    carteirinha = models.CharField("Numero da Carteirinha",
                                   max_length=35,
                                   null=True,
                                   blank=True)
    data_recebimento = models.DateField("Data Recebimento",
                                        auto_now=False,
                                        auto_now_add=False,
                                        null=False)
    tipo = models.CharField("Tipo Cadastro",
                            max_length=25,
                            default="Inclusão de Parentesco",
                            editable=False)
    data_nascimento = models.DateField("Data Nascimento",
                                       auto_now_add=False,
                                       auto_now=False,
                                       blank=False,
                                       null=False)
    data_casamento = models.DateField("Data Casamento",
                                      auto_now_add=False,
                                      auto_now=False,
                                      blank=True,
                                      null=True)
    sexo = models.CharField(max_length=25,
                            choices=sexo_choice,
                            blank=True,
                            default="Selecione",
                            null=False)
    estado_civil = models.CharField(max_length=25,
                                    choices=estado_civil_choice,
                                    default="Selecione",
                                    null=False,
                                    blank=False)
    tipo_parentesco = models.CharField(max_length=25,
                                       choices=parentesco_choice,
                                       blank=False,
                                       default="Selecione",
                                       null=False)
    anexo_doc_parentesco = models.ImageField(upload_to='anexo_parentescos',
                                             blank=True,
                                             null=True)
    anexo_doc_casamento = models.ImageField(upload_to=doc_casamento_path,
                                            blank=True,
                                            null=True)
    anexo_doc_nascimento = models.ImageField(upload_to=doc_nascimento_path,
                                             blank=True,
                                             null=True)
    nome_mae = models.CharField("Nome da Mae", max_length=255)
    data_admissao = models.DateField("Data de Admissão",
                                     auto_now=False,
                                     auto_now_add=False,
                                     null=False)
    titular = models.ForeignKey(Titular, on_delete=models.CASCADE, blank=False)
    CEP = BRPostalCodeField("Código Postal", max_length=14, null=False)
    celular = models.CharField("Numero do Celular", max_length=100, null=True)
    cidade = models.CharField("Cidade",
                              max_length=150,
                              blank=False,
                              null=False)
    estado = BRStateField("Estado UF", max_length=150, blank=False, null=False)
    declaracao_saude = models.CharField(max_length=25,
                                        choices=declaracao_saude_choice,
                                        blank=False,
                                        default="Selecione",
                                        null=False)
    desc_declarao_saude = models.CharField("Desc. Declaracao Saude",
                                           max_length=255,
                                           blank=True)
    observacoes = models.TextField("Obs.", blank=True, null=True)
    ativo = models.BooleanField(default=True)
    transferido = models.BooleanField(default=False)
    criado_em = models.DateTimeField("Criado em", auto_now_add=True)
    atualizado_em = models.DateTimeField("Atualizado em", auto_now=True)

    def prioridade(self):
        if self.ativo:
            if self.criado_em > timezone.now() - timedelta(days=30):
                return 'prioridade'
        return 'sem prioridade'

    def __str__(self):
        return f'{self.nome} - CPF: {self.CPF}'

    class Meta:
        ordering = ['ativo']
Пример #11
0
class Grupos(models.Model):
    objects = models.Manager()

    admin = models.ManyToManyField(settings.AUTH_USER_MODEL,
                                   verbose_name='Administradores',
                                   related_name='admin')

    nome = models.CharField('Nome do grupo', max_length=20, unique=True)
    capa = models.ImageField('Capa',
                             blank=True,
                             null=True,
                             upload_to='grupos/capas')
    logo = models.ImageField('Logo',
                             blank=True,
                             null=True,
                             upload_to='grupos/logos')
    slug = models.SlugField()
    criacao = models.DateTimeField('Criado em', auto_now_add=True)
    modificacao = models.DateTimeField('Modificado em', auto_now=True)

    estado = BRStateField('Estado',
                          choices=STATE_CHOICES,
                          max_length=2,
                          blank=True,
                          null=True)
    cidade = models.CharField('Cidade', max_length=50, blank=True)

    participantes = models.ManyToManyField(settings.AUTH_USER_MODEL,
                                           verbose_name='Participantes',
                                           blank=True,
                                           related_name='participantes')
    pedais = models.ManyToManyField('grupos.Pedal',
                                    verbose_name='Pedais',
                                    blank=True)

    publico = models.BooleanField('Público', default=True)
    convites_enviados = models.ManyToManyField(
        'SolicitacaoParticipacaoDeGrupo',
        verbose_name='Convites Enviados',
        related_name='convites_enviados',
        blank=True)
    solicitacoes_aguardando_aprovacao = models.ManyToManyField(
        'SolicitacaoParticipacaoDeGrupo',
        verbose_name='Convites Aguardando Aprovação',
        related_name='solicitacoes_aguardando_aprovacao',
        blank=True)

    class Meta:
        verbose_name = 'Grupo'
        verbose_name_plural = 'Grupos'

    def __str__(self):
        return self.nome

    def slugfy(self, nome):
        from unicodedata import normalize
        sem_acento = normalize('NFKD', nome).encode('ASCII',
                                                    'ignore').decode('ASCII')
        return sem_acento.replace(' ', '-').lower()

    def save(self, *args, **kwargs):
        self.slug = self.slugfy(self.nome)
        super(Grupos, self).save(*args,
                                 **kwargs)  # Call the real save() method

    @property
    def pedais_ativos(self):
        return self.pedais.filter(ativo=True).order_by('-modificacao')

    @property
    def realizados(self):
        return self.pedais.filter(ativo=False).order_by('-criacao')
Пример #12
0
class Profile(TimestampedModel):

    objects = models.Manager()

    user = AutoOneToOneField('contas.User',
                             primary_key=True,
                             on_delete=models.CASCADE)
    nome = models.CharField('Nome Completo', max_length=255)
    image = models.ImageField('Foto',
                              blank=True,
                              null=True,
                              upload_to='perfis/foto')

    meus_grupos = models.ManyToManyField('grupos.Grupos',
                                         related_name='meus_grupos',
                                         verbose_name='Meus Grupos',
                                         blank=True)

    grupos_deletados = models.ManyToManyField('grupos.Grupos',
                                              related_name='grupos_deletados',
                                              verbose_name='Grupos Deletados',
                                              blank=True)

    convites_de_grupo_recebidos = models.ManyToManyField(
        'grupos.SolicitacaoParticipacaoDeGrupo',
        verbose_name='Convites de Grupo',
        related_name='convites_de_grupo_recebidos',
        blank=True)

    pedidos_participar_grupo = models.ManyToManyField(
        'grupos.SolicitacaoParticipacaoDeGrupo',
        verbose_name='Pedidos para entrar em Grupo',
        related_name='pedidos_participar_grupo',
        blank=True)

    convites_de_pedal_recebidos = models.ManyToManyField(
        'grupos.SolicitacaoParticipacaoDePedal',
        verbose_name='Convites de Pedal',
        related_name='convites_de_pedal_recebidos',
        blank=True)

    pedidos_participar_pedal = models.ManyToManyField(
        'grupos.SolicitacaoParticipacaoDePedal',
        verbose_name='Pedidos de Participação de Pedal',
        related_name='pedidos_participar_grupo',
        blank=True)

    pedais_agendados = models.ManyToManyField('grupos.Pedal',
                                              related_name='pedais_agendados',
                                              verbose_name='Pedais Marcados',
                                              blank=True)

    pedais_deletados = models.ManyToManyField('grupos.Pedal',
                                              related_name='pedais_deletados',
                                              verbose_name='Pedais Excluidos',
                                              blank=True)

    sexos = (
        ('1', 'Masculino'),
        ('2', 'Feminino'),
    )
    sexo = models.CharField('Sexo',
                            max_length=1,
                            choices=sexos,
                            blank=True,
                            null=True)

    nascimento = models.DateField('Data de Nascimento', blank=True, null=True)
    phone_digits_re = re.compile(r'^[(\.](\d{2})[)\.]?(\d{4,5})[-\.]?(\d{4})$')
    telefone = models.CharField(
        'Telefone',
        max_length=15,
        validators=[validators.RegexValidator(phone_digits_re)],
        blank=True)
    tel_emergencia = models.CharField(
        'Telefone de emergências',
        max_length=15,
        validators=[validators.RegexValidator(phone_digits_re)],
        blank=True)

    is_admin = models.BooleanField('Admin', default=False)

    # Localização
    cidade = models.CharField('Cidade', max_length=50, blank=True)
    estado = BRStateField('Estado',
                          choices=STATE_CHOICES,
                          max_length=2,
                          blank=True)

    def __str__(self):
        return self.user.username

    def get_short_name(self):
        return str(self).split(" ")[0]

    def nice_birth_date(self):
        nice_time = self.nascimento.strftime("%d/%m/%Y")
        return nice_time

    @property
    def historico_de_pedais(self):
        #return list(filter(lambda x: x.data < date.today(), self.pedais_agendados.all()))
        return self.pedais_agendados.filter(data__lt=date.today())

    @property
    def idade(self):
        today = date.today()
        if self.nascimento:
            try:
                birthday = self.nascimento.replace(year=today.year)
            except ValueError:
                # raised when birth date is February 29 and the current year is not a leap year
                birthday = self.nascimento.replace(
                    year=today.year, month=self.nascimento.month + 1, day=1)
            finally:
                if birthday > today:
                    return today.year - self.nascimento.year - 1
                else:
                    return today.year - self.nascimento.year
        return '-'
Пример #13
0
class Dados_Mapeamento_startup(models.Model):
#dados cadastrais
    
    nome = models.CharField(max_length=100) # unique= True
    site = models.URLField(max_length=400, blank=True) 
    email = models.EmailField() 
    cnpj = BRCNPJField(null=True,blank=True) #fazer validação cnpj com js ou jquery
    logo = models.ImageField(upload_to='BigV_app_map/static/media_root',null=True,blank=True) 
########################################################################################################################################

#endereço
    cep = BRPostalCodeField(max_length=9, default='')           #fazer preenchimento automatico 
    rua = models.CharField(max_length=100, default='')
    bairro = models.CharField(max_length=100, default='')
    cidade = models.CharField(max_length=100, default='')       #fazer como baixa de rolagem                                  
    estado = BRStateField()
# ########################################################################################################################################

# #dados do Representante 
    nome_representante = models.CharField(max_length=100, default='')
    cargo = models.CharField(max_length = 20, default='')
    telefone = PhoneNumberField()
    email_representante = models.EmailField(default='')
# ########################################################################################################################################

# # Características da startup


    setor_de_atuaca_CHOICES = (
        ("ind", 'Indústria'),
        ("com", 'Comércio'),
        ("ser", 'Serviços'),
    )

    setor_de_atuacao = MultiSelectField(choices = setor_de_atuaca_CHOICES)

#     ##################################################################################

    area_de_atuacao_da_startup = models.CharField(max_length = 1000, default='')
    ##################################################################################
    segArea_CHOICES = ( 
                        seg_area_lazy() 
    
                    )

    segmento_area = models.CharField(max_length=100, choices = segArea_CHOICES,default='')
    ##################################################################################

    detalhes_de_area_de_atuacao = models.CharField(max_length = 1000, default='')

    ##################################################################################
    segAtu_CHOICES = ( 
                        seg_atu_lazy() 
                    )

    segmento_de_atuacao = models.CharField(max_length=100, choices = segAtu_CHOICES,default='')
    ##################################################################################
    tipoCliente_CHOICES = (
        ('B2B', 'Empresas e Negócios (B2B) '),
        ('B2C', 'Consumidores (B2C)'),
        ('GOV', 'Governo'),
    )
    tipo_de_cliente = models.CharField(max_length=100, choices = tipoCliente_CHOICES,default='')

# ########################################################################################################################################


#Questionário 
    sim_nao_CHOICES1 = ((True, 'Sim'), (False, 'Não'))
    sim_nao_CHOICES2 = ((True, 'Sim'), (False, 'Não'))
    sim_nao_CHOICES3 = ((True, 'Sim'), (False, 'Não'))
    sim_nao_CHOICES4 = ((True, 'Sim'), (False, 'Não'))
    

    possui_mercado_global = models.BooleanField(choices = sim_nao_CHOICES1,default=True)

    possui_Influencia_ou_interesse_militar =  models.BooleanField(choices = sim_nao_CHOICES2,default=True)
    ##################################################################################

    saida_neg_CHOICES = (
                        ('cre','Crescimento Lucrativo para o Mercado Global '),
                        ('aqu','Aquisição por uma Grande Empresa'),
                        ('fus','Fusão com outra empresa'),
                        ('ofe','Oferta Pública Inicial de Ações'),
            )
    qual_estrategia_de_saida_ou_idealizada_para_o_negocio = MultiSelectField(choices=saida_neg_CHOICES,default=0)

    ##################################################################################

    possui_CHOICES = (
                        ('lsu','Lean Start up '),
                        ('mod','Modelo de Negócios'),
                        ('des','Designer Thinking'),
                        ('out','Outras ?'), # pensar num if aqui 
            )
    sua_startup_possui_conhecimento_ou_e_treinada_nas_metodologias_descritas_abaixo = MultiSelectField(choices=possui_CHOICES,default=0)
    caso_outra = models.CharField(max_length=100,blank=True,null=True)

    ##################################################################################

    startup_foi_fundada_dentro_dos_5_anos_de_graduacao_dos_fundadores = models.BooleanField(choices = sim_nao_CHOICES3,default=True)

    numero_de_socios =   models.CharField(max_length = 255, default='')
    ano_de_fundacao  =   models.CharField(max_length = 4, default='')

    ja_foi_investida =   models.BooleanField(choices=sim_nao_CHOICES4, default=True)
    quantas_rodadas  =   models.CharField(max_length = 255, default='') ##botar numeros 

    montante_investido = models.CharField(max_length = 255, default='')


    receita_CHOICES = ( 
                        receita_lazy() 
                    )
    quais_os_modelos_de_receitas_se_enquadra_no_perfil_da_empresa_startup = models.CharField(max_length = 100000,choices=receita_CHOICES,default='')
    quais_programas_iniciativas_movimentos_de_empreendedorismo_e_inovacao_que_participa = models.TextField(max_length = 100000, default='')
    com_quais_entidades_do_ecossistema_tem_conexao_interacao_frequente_projetos_em_parceria_colaboracao_que_contribuiram_e_contribuem_para_as_inovacoes_e_aperfeicoamento_da_empresa = models.TextField(max_length = 100000,default='')

    esfera_CHOICES = (
                        ("reg",'Regional'),
                        ("est",'Estadual'),
                        ('nac','Nacional'),
                        ('int','Internacional'),
    )
    estes_parceiros_listados_acima_possuem_que_esfera = MultiSelectField(choices=esfera_CHOICES, default=0)

    def __str__(self):
        return self.nome

    class Meta: 
        verbose_name_plural = "Dados_Mapeamento_Startup"
Пример #14
0
class Dados_Mapeamento_empresa(models.Model):
    
    nome = models.CharField(max_length=10)
    #Dados Cadastrias   ######################################
    pessoas_choices = (
                        ("PF","Pessoa Física"),
                        ("PJ","Pessoa Jurídica"),
    )
    pessoa = models.CharField(max_length=100, choices=pessoas_choices, default='')
    logo = models.ImageField(upload_to='BigV_app_map/static/media_root',null=True,blank=True) 
    
    #endereço institucional ######################################

    cep = BRPostalCodeField(max_length=9, default='')           #fazer preenchimento automatico 
    rua = models.CharField(max_length=100, default='')
    bairro = models.CharField(max_length=100, default='')
    cidade = models.CharField(max_length=100, default='')       #fazer como baixa de rolagem                                  
    estado = BRStateField(default='')
    site = models.URLField(max_length=400, blank=True) 
    email = models.EmailField(default='') 
    #Dados do representante ######################################
    
    nome_representante = models.CharField(max_length=100, default='')
    cargo = models.CharField(max_length = 20, default='')
    telefone = PhoneNumberField(default='')
    email_representante = models.EmailField(default='')
    #Campo de Abrangência da Instituição Cadastrada ######################################
    
    itens_choices = (
                    ('aca','Academia (inst. de Nível Técnico ou Superior)'),
                    ('empre','Empresa'),
                    ('soc','Sociedade'),
                    ('gov','Governo'),                              
    )
    em_qual_destes_itens_abaixo_seu_cadastro_se_enquadra = MultiSelectField(choices = itens_choices, default=0)

    setores_choices = ( 
                    ('pol','Política'),
                    ('cul','Cultura'),
                    ('ch','Capital Humano'),
                    ('fin','Financeiro'),
                    ('sup','Suporte'),
                    ('merc','Mercado'),
)
    em_qual_destes_setores_a_instituicao_se_enquadra = models.CharField(max_length=100,choices = setores_choices, null=True)
    segmento_choices = ( 
                        seg_atu_lazy()
                        )
    ##Politica##
    ref_choices = (
        ('gov','Gorverno'),
        ('out','Outras Lideranças Política'),
    )
    sobre_referencia_politica = models.CharField(max_length=100,choices = ref_choices, default='',null=True,blank=True)
    #################################opções########################################################
    ## Cultura ##
    refcul_choices = (
        ('cul','Cultura / Valores Sociais e Empreendedores'),
    )
    referente_a_cultura = models.CharField(max_length=100,choices = refcul_choices,null=True,blank=True)
    
    ## Capital Humano ##
    refch_choices = ( 
                capital_humano_lazy() 
            )
    
    referente_a_capital_humano = models.CharField(max_length=100,choices = refch_choices,null=True,blank=True)
    
    ## Financeiro ##
    reffin_choices = (
        ('fin','Capital'),
    )
    referente_a_financeiro = models.CharField(max_length=100,choices = reffin_choices,null=True,blank=True)
    
    ## Suportee ##
    
    refsup_choices = ( 
                suporte_lazy()
            )
    
    referente_a_suporte = models.CharField(max_length=100,choices = refsup_choices,null=True,blank=True)
    
    ## Mercado ##
    
    ## não tem nada, perguntar pro samuel 
    # refmerc_choices  = (
        
    # )
    # referente_a_mercado = models.CharField(max_length=100,choices = refsup_choices,null=True,blank=True)
    
    
    
    
    refch_choices = ( 
                        seg_atu_lazy()
                    )
    segmento = models.CharField(max_length=100,choices = refch_choices, default='')


################################################################################################################

    #Sobre Projetos, Iniciativas, parcerias e infraestrutura ######################################
    programas_iniciativas_movimentos_de_empreendedorismo_e_inovacao_que_executa = models.TextField(max_length = 100000, default='')
    programas_iniciativas_movimentos_de_empreendedorismo_e_inovacao_que_participa = models.TextField(max_length = 100000, default='')
    equipamentos_disponiveis_para_uso_compartilhado_prestacao_de_servico_no_Ecossistema_Regional = models.TextField(max_length = 100000, default='')
    


    def __str__(self):
        return self.nome

    class Meta: 
        verbose_name_plural = "Dados_Mapeamento_Empresa"