Skip to content

Commit

Permalink
Created a model for the postal code table from Geonames. Includes all
Browse files Browse the repository at this point in the history
the columns that are mentioned in
http://www.geonames.org/export/zip/readme.txt
  • Loading branch information
Andrew Smith committed Nov 15, 2011
1 parent 744ec09 commit 675b394
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions geonames/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,22 @@ class Meta:

def __unicode__(self):
return self.geoname.name

class PostalCode(models.Model):
countrycode = models.CharField(max_length=2)
postalcode = models.CharField(max_length=20)
placename = models.CharField(max_length=180)
admin1name = models.CharField(max_length=100)
admin1code = models.CharField(max_length=20)
admin2name = models.CharField(max_length=100)
admin2code = models.CharField(max_length=20)
admin3name = models.CharField(max_length=100)
admin3code = models.CharField(max_length=20)
latitude = models.FloatField()
longitude = models.FloatField()
accuracy = models.SmallIntegerField()

objects = models.GeoManager()

def __unicode__(self):
return self.placename

0 comments on commit 675b394

Please sign in to comment.