2009-12-24 04:45:08 +08:00
|
|
|
from django.contrib.gis.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2009-12-24 04:45:08 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2009-12-24 04:45:08 +08:00
|
|
|
class City(models.Model):
|
|
|
|
name = models.CharField(max_length=30)
|
|
|
|
point = models.PointField(geography=True)
|
|
|
|
objects = models.GeoManager()
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self): return self.name
|
2009-12-24 04:45:08 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2009-12-24 04:45:08 +08:00
|
|
|
class Zipcode(models.Model):
|
|
|
|
code = models.CharField(max_length=10)
|
|
|
|
poly = models.PolygonField(geography=True)
|
|
|
|
objects = models.GeoManager()
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self): return self.code
|
2009-12-25 22:37:57 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2009-12-25 22:37:57 +08:00
|
|
|
class County(models.Model):
|
|
|
|
name = models.CharField(max_length=25)
|
|
|
|
state = models.CharField(max_length=20)
|
|
|
|
mpoly = models.MultiPolygonField(geography=True)
|
|
|
|
objects = models.GeoManager()
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self): return ' County, '.join([self.name, self.state])
|