Skip to content

Instantly share code, notes, and snippets.

@fchevitarese
Created June 20, 2016 20:36
Show Gist options
  • Save fchevitarese/bbf6135007635f679616c07ea1a925e5 to your computer and use it in GitHub Desktop.
Save fchevitarese/bbf6135007635f679616c07ea1a925e5 to your computer and use it in GitHub Desktop.
modelo.py
class Esporte(models.Model):
"""(Esporte description)"""
nome = models.CharField(blank=True, max_length=100)
sexo = models.CharField(blank=True, max_length=1, choices=['M', 'F'])
idade = models.IntegerField()
def __unicode__(self):
return u"Esporte"
class Pessoa(models.Model):
"""(Pessoa description)"""
sexo = models.CharField(blank=True, max_length=1, choices=['M', 'F'])
idade = models.IntegerField()
def __unicode__(self):
return u"Pessoa"
class EsportePessoa(models.Model):
"""(EsportePessoa description)"""
pessoa = models.ForeignKey('Pessoa')
esporte = models.ForeignKey('Esporte')
def __unicode__(self):
return u"EsportePessoa"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment