Models optimiert
This commit is contained in:
+11
-3
@@ -37,6 +37,9 @@ class Competition(models.Model):
|
||||
leagueName = models.CharField(max_length=128)
|
||||
season = models.CharField(max_length=4)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("leagueShortcut", "season")
|
||||
|
||||
def __unicode__(self):
|
||||
return (self.leagueShortcut)
|
||||
|
||||
@@ -62,6 +65,12 @@ class Match(models.Model):
|
||||
group = models.IntegerField()
|
||||
matchday = models.IntegerField()
|
||||
matchday_name = models.CharField(max_length=128)
|
||||
|
||||
competition = models.ForeignKey(
|
||||
Competition,
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
idTeam1 = models.ForeignKey(
|
||||
Team, related_name='+',
|
||||
on_delete=models.CASCADE
|
||||
@@ -70,11 +79,10 @@ class Match(models.Model):
|
||||
Team, related_name='+',
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
pointsTeam1 = models.SmallIntegerField()
|
||||
pointsTeam2 = models.SmallIntegerField()
|
||||
finished = models.BooleanField()
|
||||
season = models.CharField(max_length=4)
|
||||
leagueShortcut = models.CharField(max_length=12)
|
||||
|
||||
def __unicode__(self):
|
||||
return (str(self.matchID))
|
||||
@@ -121,7 +129,7 @@ class Score(models.Model):
|
||||
return str(self.client)
|
||||
|
||||
|
||||
class chart(models.Model):
|
||||
class Chart(models.Model):
|
||||
team = models.ForeignKey(
|
||||
Team,
|
||||
on_delete=models.CASCADE
|
||||
|
||||
Reference in New Issue
Block a user