Skip to content

Instantly share code, notes, and snippets.

@felipebastosweb
Last active December 15, 2016 16:40
Show Gist options
  • Select an option

  • Save felipebastosweb/21461e652780fa5e0efd00731885a9bb to your computer and use it in GitHub Desktop.

Select an option

Save felipebastosweb/21461e652780fa5e0efd00731885a9bb to your computer and use it in GitHub Desktop.
Trecho do Modelo de Domínio do módulo Escola que trata da Grade curricular do Curso
class Area(models.Model):
nomecurso = models.CharField(max_length=255)
instituicao = models.CharField(max_length=255)
# __unicode__ on Python 2
def __str__(self):
return self.nome
class Disciplina(models.Model):
nome = models.CharField(max_length=255)
cargahoraria = models.IntegerField()
serie = models.ForeignKey(Serie, on_delete=models.CASCADE)
# __unicode__ on Python 2
def __str__(self):
return self.nome +" - Carga Horária:"+ self.cargahoraria +"h " + str(self.serie)
class Professor(Funcionario):
area = models.ForeignKey(Area, on_delete=models.CASCADE)
# __unicode__ on Python 2
def __str__(self):
return self.serie.nome
class Meta(Funcionario.Meta):
pass
class ProfessorTurma(models.Model):
professor = models.ForeignKey(Professor, on_delete=models.CASCADE)
turma = models.ForeignKey(Turma, on_delete=models.CASCADE)
disciplina = models.ForeignKey(Disciplina, on_delete=models.CASCADE)
# __unicode__ on Python 2
def __str__(self):
return str(self.turma) + str(self.disciplina) + str(self.professor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment