Skip to content Skip to sidebar Skip to footer

Django Point Definition

my models: class Mod(models.model) name = models.CharField(max_length = 255) co_x = models.DecimalField(max_digits = 11, decimal_places = 8) co_y = models.DecimalField(

Solution 1:

Ok, so it's now clear your error message comes from initializing a Point class with None.

That is your first critical problem.

Judging by the error message, my guess is that poi_s is initialized with None, None as Mod() is an unsaved instance with no values and those are the invalid parameters.

sk = Mod() # unsaved Mod instance with no defaults
poi_s = Point(sk.co_x, co_y, srid = 900913)
# sk.co_x is None

Your second problem that will appear after fixing the above is querying a model with an invalid lookup type (specific to PointField, __distance) which accepts a tuple. How to solve that, I don't know.

You would have to look at how GeoDjango translates that tuple into a DB lookup.


Post a Comment for "Django Point Definition"