import uuid from django.db import models # Create your models here. from djgeojson.fields import PointField, MultiPolygonField class Address(models.Model): id = models.UUIDField('id', primary_key=True, default=uuid.uuid4) name = models.CharField('区域', max_length=256, null=False) geom = PointField() 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) station = models.ForeignKey(Station, on_delete=models.CASCADE) geom = PointField() 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()