django1/django/contrib/gis/tests/distapp/models.py

56 lines
1.4 KiB
Python
Raw Normal View History

from django.contrib.gis.db import models
from django.utils.encoding import python_2_unicode_compatible
2013-11-03 04:12:09 +08:00
@python_2_unicode_compatible
class NamedModel(models.Model):
name = models.CharField(max_length=30)
objects = models.GeoManager()
class Meta:
abstract = True
app_label = 'distapp'
def __str__(self):
return self.name
2013-11-03 04:12:09 +08:00
class SouthTexasCity(NamedModel):
"City model on projected coordinate system for South Texas."
point = models.PointField(srid=32140)
class SouthTexasCityFt(NamedModel):
"Same City model as above, but U.S. survey feet are the units."
point = models.PointField(srid=2278)
class AustraliaCity(NamedModel):
"City model for Australia, using WGS84."
point = models.PointField()
2013-11-03 04:12:09 +08:00
class CensusZipcode(NamedModel):
"Model for a few South Texas ZIP codes (in original Census NAD83)."
name = models.CharField(max_length=5)
poly = models.PolygonField(srid=4269)
2013-11-03 04:12:09 +08:00
class SouthTexasZipcode(NamedModel):
"Model for a few South Texas ZIP codes."
name = models.CharField(max_length=5)
poly = models.PolygonField(srid=32140, null=True)
2013-11-03 04:12:09 +08:00
class Interstate(NamedModel):
"Geodetic model for U.S. Interstates."
name = models.CharField(max_length=10)
path = models.LineStringField()
2013-11-03 04:12:09 +08:00
class SouthTexasInterstate(NamedModel):
"Projected model for South Texas Interstates."
name = models.CharField(max_length=10)