Skip to content

Commit

Permalink
Cadastro e alterações no usuário
Browse files Browse the repository at this point in the history
  • Loading branch information
JAugusto-Moraes committed Dec 4, 2023
1 parent 2d63872 commit bc4203e
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 813 deletions.
17 changes: 10 additions & 7 deletions inicial/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ class Meta:
verbose_name = "dados"
verbose_name_plural = "Dados"

SEXO = [
("femininino", "Feminino"),
("masculino", "Masculino"),
("na","Não informado")
GENERO = [
("na","Não informado"),
("homem-cis", "Homem cis"),
("homem-trans", "Homem trans"),
("mulher-cis", "Mulher cis"),
("mulher-trans", "Mulher trans"),
("nao-binario", "Não-binário"),
("outro", "Outro")
]

TIPO_SANGUINIO = [
Expand All @@ -131,9 +135,8 @@ class Meta:
]

usuario = models.OneToOneField(User,on_delete=models.CASCADE, primary_key=True)
nome = models.CharField(max_length=200, null=False, blank=False, default="Não informado")
idade = models.IntegerField(null=False, blank=False, default=0)
sexo = models.CharField(max_length=20, null=False, blank=False, default="na", choices=SEXO)
data_nascimento = models.DateField(null=False, blank=False, default=timezone.now)
genero = models.CharField(max_length=20, null=False, blank=False, default="na", choices=GENERO)
profissao = models.CharField(max_length=200, null=False, blank=False, default="Não informada")
endereco = models.CharField(max_length=200, null=False, blank=False, default="Não informado")
telefone = models.CharField(max_length=20, null=False, blank=False, default="Não informado")
Expand Down
10 changes: 2 additions & 8 deletions inicial/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def update_time(sender, instance, created, **kwargs):
risco = instance.risco
duracao = Avaliacao.objects.filter(hospital=hospital).filter(risco=risco).aggregate(Avg("duracao", default=timedelta(minutes=0)))
minutos = round(duracao["duracao__avg"].seconds / 60)

avaliacao = Avaliacao.objects.filter(hospital=hospital).aggregate(Avg("avaliacao", default=0))
nota = avaliacao["avaliacao__avg"]
hospital.nota = nota
Expand All @@ -33,11 +33,5 @@ def update_time(sender, instance, created, **kwargs):
if risco == "NAO_URGENTE":
hospital.tempo_nao_urgente = minutos

hospital.atualizacao = timezone.now
hospital.atualizacao = timezone.now()
hospital.save()

@receiver(post_save, sender=User)
def create_data(sender, instance, created, **kwargs):
if created:
dados = Dados(usuario=instance)
dados.save()
319 changes: 0 additions & 319 deletions inicial/static/styles/css_criarconta.css

This file was deleted.

Loading

0 comments on commit bc4203e

Please sign in to comment.