django/tests/gis_tests/distapp/models.py

52 lines
1.3 KiB
Python
Raw Normal View History

from django.contrib.gis.db import models
from ..utils import gisfield_may_be_null
2013-11-02 20:12:09 +00:00
class NamedModel(models.Model):
name = models.CharField(max_length=30)
class Meta:
abstract = True
required_db_features = ['gis_enabled']
def __str__(self):
return self.name
2013-11-02 20:12:09 +00:00
class SouthTexasCity(NamedModel):
"City model on projected coordinate system for South Texas."
point = models.PointField(srid=32140)
radius = models.IntegerField(default=10000)
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()
radius = models.IntegerField(default=10000)
2013-11-02 20:12:09 +00:00
class CensusZipcode(NamedModel):
"Model for a few South Texas ZIP codes (in original Census NAD83)."
poly = models.PolygonField(srid=4269)
2013-11-02 20:12:09 +00:00
class SouthTexasZipcode(NamedModel):
"Model for a few South Texas ZIP codes."
poly = models.PolygonField(srid=32140, null=gisfield_may_be_null)
2013-11-02 20:12:09 +00:00
class Interstate(NamedModel):
"Geodetic model for U.S. Interstates."
path = models.LineStringField()
2013-11-02 20:12:09 +00:00
class SouthTexasInterstate(NamedModel):
"Projected model for South Texas Interstates."
2014-01-01 10:52:56 +00:00
path = models.LineStringField(srid=32140)