Created
January 28, 2012 11:36
-
-
Save debuggerpk/1694025 to your computer and use it in GitHub Desktop.
models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
# Create your models here. | |
class Leagues(models.Model): | |
LeagueName = models.CharField(max_length=200) | |
def __unicode__(self): | |
return self.LeagueName | |
class Team(models.Model): | |
TeamLeague = models.ForeignKey(Leagues) | |
TeamName = models.CharField(max_length=200) | |
def __unicode__(self): | |
return self.TeamName | |
class LeagueTable(models.Model): | |
league = models.ForeignKey(Leagues) | |
team = models.ForeignKey(Team) | |
matches_played = models.IntegerField() | |
matches_won = models.IntegerField() | |
matches_drawn = models.IntegerField() | |
matches_lost = models.IntegerField() | |
points = models.IntegerField() | |
class FixtureTable(models.Model): | |
league = models.ForeignKey(Leagues) | |
fixture_date = models.DateField('Fixture Date') | |
team_one = models.ForeignKey(Team, related_name="home_set") | |
team_one_score = models.IntegerField() | |
team_two = models.ForeignKey(Team, related_name="away_set") | |
team_two_score = models.IntegerField() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment