1 from django
.contrib
.gis
.db
import models
3 class City(models
.Model
):
4 name
= models
.CharField(max_length
=30)
5 point
= models
.PointField(geography
=True)
6 objects
= models
.GeoManager()
7 def __unicode__(self
): return self
.name
9 class Zipcode(models
.Model
):
10 code
= models
.CharField(max_length
=10)
11 poly
= models
.PolygonField(geography
=True)
12 objects
= models
.GeoManager()
13 def __unicode__(self
): return self
.code
15 class County(models
.Model
):
16 name
= models
.CharField(max_length
=25)
17 state
= models
.CharField(max_length
=20)
18 mpoly
= models
.MultiPolygonField(geography
=True)
19 objects
= models
.GeoManager()
20 def __unicode__(self
): return ' County, '.join([self
.name
, self
.state
])