drought_backup/graphic/models.py

41 lines
1.2 KiB
Python
Raw Normal View History

2018-07-06 11:57:46 +00:00
import uuid
2018-07-06 11:22:59 +00:00
from django.db import models
# Create your models here.
2018-07-07 10:04:13 +00:00
from djgeojson.fields import PointField, MultiPolygonField
2018-07-06 11:57:46 +00:00
class Address(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('区域', max_length=256, null=False)
geom = PointField()
2018-07-06 14:56:17 +00:00
class Station(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
code = models.CharField('区站号', max_length=256, null=False)
geom = PointField()
class Grid(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
2018-07-07 10:04:13 +00:00
station = models.ForeignKey(Station, on_delete=models.CASCADE)
2018-07-06 14:56:17 +00:00
geom = PointField()
2018-07-07 10:04:13 +00:00
class CountyBoundary(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('县名', max_length=256, null=False)
geom = MultiPolygonField()
class TownBoundary(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('乡名', max_length=256, null=False)
county = models.ForeignKey(CountyBoundary, on_delete=models.CASCADE)
geom = MultiPolygonField()