On Thursday, January 17, 2013 12:34:23 AM UTC-5, Mac wrote:
You could create another field under Stat called team, and rename the class stat to "Stint" or "Term" or "Session" ( I can't think of a better word ) to represent the stats of the player's "stint" at that team, that year.--
You may also want to and another field to represent how many times the player was traded that season, and in what order, most likely using an integer field.
Ex:
class Stint(models.Model):
# some stuff here
team = models.CharField()
year = models.IntegerField()
traded = models.IntegerField() #if 0, then he wasn't traded, if 1 this is his 2nd team, etc...
Hope this helps,
Mac
On Wednesday, January 16, 2013 3:59:24 PM UTC-8, David Gomez wrote:Hi, I would like to make a website about baseball player from an specific country, but I'm stock how to make the model for the player stat.My Current a sample model is like this (The Stat Class is going to be much longer):class PLayer_Bios(models.Model):my_id = models.SlugField(unique=True)mlb_id = models.CharField(max_length=50) name = models.CharField(max_length=50) last = models.CharField(max_length=50) middle = models.CharField(max_length=50, blank=True) jersey = models.CharField(max_length=5)weight = models.CharField(max_length=10) height = models.CharField(max_length=10) bod = models.CharField(max_length=50) birth_city = models.CharField(max_length=50) birth_country = models.CharField(max_length=50) pro_debut_date = models.CharField(max_length=50) primary_position = models.CharField(max_length=50) team_name = models.CharField(max_length=50) throws = models.CharField(max_length=50) bats = models.CharField(max_length=50) def __unicode__(self):return self.nameclass Stat (models.Model):player_id = models.ForeignKey('PLayer_Bios') stat_id = models.CharField(max_length=50, unique=True) year = models.IntegerField(max_length=50) h = models.IntegerField(max_length=50) 2h = models.IntegerField(max_length=50) def __unicode__(self):return self.stat_idHere is how I want the template to look like:Each PLayer have this stat and if you see the year, the stat can have repeat year in two different row if the player was move to another team. Thanks in advance
BATTING Regular Season Career Stats YEAR▲ TEAM LG LEVEL G AB R H TB 2B 3B HR RBI BB IBB SO SB CS AVG OBP SLG OPS GO/AO 1992 Minors 58 210 23 44 66 10 0 4 29 26 0 52 2 3 .210 .311 .314 .626 - 1993 GBO SAL A (Full) 128 515 85 152 203 14 11 5 71 58 1 95 18 9 .295 .376 .394 .770 - 1994 Minors 138 540 103 186 250 27 11 5 68 58 3 61 50 8 .344 .410 .463 .873 - 1995 COL INT AAA 123 486 96 154 205 27 9 2 45 61 1 56 20 12 .317 .394 .422 .816 - 1995 NYY AL MLB 15 48 5 12 18 4 1 0 7 3 0 11 0 0 .250 .294 .375 .669 - 1996 NYY AL MLB 157 582 104 183 250 25 6 10 78 48 1 102 14 7 .314 .370 .430 .800 -
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/g9we0yl7DVoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment