comparison mysite/band/models.py @ 5:e602b5302b94

Added support for countries beside the USA.
author Brian Neal <bgneal@gmail.com>
date Thu, 14 May 2009 00:31:39 +0000
parents 0dcfcdf50c62
children dac690ab98b2
comparison
equal deleted inserted replaced
4:432f7467543a 5:e602b5302b94
58 class Meta: 58 class Meta:
59 verbose_name_plural = 'Gear List' 59 verbose_name_plural = 'Gear List'
60 60
61 ####################################################################### 61 #######################################################################
62 62
63 class Country(models.Model):
64 name = models.CharField(max_length=64)
65
66 class Meta:
67 ordering = ('name', )
68 verbose_name_plural = 'Countries'
69
70 def __unicode__(self):
71 return self.name
72
73 #######################################################################
74
63 class State(models.Model): 75 class State(models.Model):
64 name = models.CharField(max_length = 16) 76 name = models.CharField(max_length = 16)
65 abbrev = USStateField() 77 abbrev = USStateField()
66 78
67 class Meta: 79 class Meta:
73 ####################################################################### 85 #######################################################################
74 86
75 class City(models.Model): 87 class City(models.Model):
76 name = models.CharField(max_length = 50) 88 name = models.CharField(max_length = 50)
77 state = models.ForeignKey(State, null = True, blank = True) 89 state = models.ForeignKey(State, null = True, blank = True)
90 country = models.ForeignKey(Country, null=True, blank=True)
78 91
79 class Meta: 92 class Meta:
80 verbose_name_plural = 'Cities' 93 verbose_name_plural = 'Cities'
81 ordering = ('name', ) 94 ordering = ('name', )
82 95