0
我在計算「Pelicula」的平均分數。所述分數表是由「pelis(PELICULA的外鍵)」,「用戶(PELICULA的外鍵)」和勇氣(這是分)形成 這是models.py平均排序 - Django
class Usuario(models.Model):
Nombre = models.CharField(max_length=50)
apellidos = models.CharField(max_length=50)
usuario = models.CharField(max_length=50)
password = models.CharField(max_length=50)
email = models.EmailField()
fechaNacimiento = models.DateField()
categorias = models.CharField(max_length=50)
def __unicode__(self):
return self.usuario
class Pelicula(models.Model):
titulo = models.CharField(max_length=50)
anyo = models.CharField(max_length=50)
actores = models.ManyToManyField('Actor')
resumen = models.CharField(max_length=300)
categoria = models.CharField(max_length=50)
puntuacionMed = models.CharField(max_length=50)
director = models.ForeignKey('Director');
def __unicode__(self):
return self.titulo
class Actor(models.Model):
Nombre = models.CharField(max_length=50)
apellidos = models.CharField(max_length=50)
biografia = models.CharField(max_length=300)
def __unicode__(self):
return self.Nombre
class Director(models.Model):
Nombre = models.CharField(max_length=50)
apellidos = models.CharField(max_length=50)
biografia = models.CharField(max_length=300)
def __unicode__(self):
return self.Nombre
class Puntuacion (models.Model):
user = models.ForeignKey('Usuario')
pelis = models.ForeignKey('Pelicula')
valor = models.IntegerField()
這項工作。很感謝。 – tipiwiny
不客氣 – Charlesthk