null value in column "geom" violates not-null constraint

18 views
Skip to first unread message

elcaiaimar

unread,
Nov 13, 2014, 11:03:13 AM11/13/14
to django...@googlegroups.com
Hello everybody, I'm working with django and geodjango and now I have a problem with the geometry. I want that users can introduce coordinates in a form and then, these are saved in a database (postgis).

Now, I can save X and Y coordinates, but the geom field doesn't work and I don't know why.

In my models.py I have create the next class:

from django.contrib.gis.db import models
class Pozo(models.Model):
    # gid_pozo = models.IntegerField(primary_key=True)
    # gid_colector = models.ForeignKey(Colector)
    coorx = models.IntegerField()
    coory = models.IntegerField()
    geom = models.PointField()
    objects = models.GeoManager()

When I introduce coordinates, I get this error:

null value in column "geom" violates not-null constraint
DETAIL:  Failing row contains (7, -1, 1, null).

7 = id, -1, 1 =coordinates, null=geom

What I can solve this trouble?

Thank you very much!
Reply all
Reply to author
Forward
0 new messages