GeoDjango & MySQL: points can't be NULL, what other “empty” value should I use?

后端 未结 3 1503
不思量自难忘°
不思量自难忘° 2021-01-18 09:21

I have this Django model:

from django.contrib.gis.db import models

class Event(models.Model):
    address = models.TextField()
    point = models.PointField         


        
3条回答
  •  清歌不尽
    2021-01-18 09:50

    I don't think you have many options here. Either you use a placeholder such as (0, 0), or you encapsulate the point in an object and reference the object everywhere you need the point. That way the reference to the object could be made nullable, but the extra join would hurt performance and complicate things.

提交回复
热议问题