How to assign to a Django PointField model attribute?

前端 未结 2 1182
没有蜡笔的小新
没有蜡笔的小新 2020-12-08 16:40

Hi I have a Django Model as follows:

class Address(models.Model):
    geoCoords = models.PointField(null=True, blank=True,)

Now I create an

2条回答
  •  北荒
    北荒 (楼主)
    2020-12-08 17:10

    In newer versions of Django you can:

    from django.contrib.gis.geos import Point
    pnt = Point(1, 1)
    

    Plenty of examples available in https://docs.djangoproject.com/en/1.11/ref/contrib/gis/geos/

提交回复
热议问题