Advertisement
pjmakey2

modelos extras datos many to many

Aug 5th, 2013
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. class Caballeros(models.Model):
  2.    nombre = models.CharField(max_length=30)
  3.  
  4. class Armaduras(models.Model):
  5.    nombre = models.CharField(max_length=30)
  6.    tipo = models.CharField(max_length=40)
  7.    caballeros = models.ManyToManyField(Caballeros, through='CaballerosArmaduras')
  8.  
  9. class CaballerosArmaduras(models.Model):
  10.     caballero = models.ForeignKey(Caballeros)
  11.     armadura = models.ForeignKey(Armaduras)
  12.     extra = models.DateField()
  13.     extra = models.CharField(max_length=64)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement