Hello,
I've finally started using the django-gis branch, which looks perfect
for me needs, however I am currently having a database persistence
problem.
I have a simple model which maps a point to a UserProfile model. This
is in a separate table as spacial indexes can't be Null and I want to
keep it optional.
class Location(models.Model):
user_profile = models.OneToOneField(UserProfile)
location = models.PointField()
map_zoom_level = models.IntegerField(blank=True, null=True)
class Admin:
pass
I can create and save a Location object with no problems
>>> location = Location(user_profile=up, location=Point(5,5))
>>> location.save()
>>> location.location.get_x()
5.0
However when reloading this location I get problems
>>> up = UserProfile.objects.get(pk=1)
>>> location = up.location
>>> location
<Location: Location object>
>>> location.location
@@
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.5/site-packages/django/contrib/gis/db/models/proxy.py",
line 36, in __get__
geom = self._klass(geom_value)
File "/usr/lib/python2.5/site-packages/django/contrib/gis/geos/base.py",
line 67, in __init__
raise ValueError('String or unicode input unrecognized as WKT
EWKT, and HEXEWKB.')
ValueError: String or unicode input unrecognized as WKT EWKT, and HEXEWKB.
The value in the database is similar to the two @s shown above, but I
presume that's as it's saved in some sort of encoded way
mysql> select * from user_location;
+-----------------+---------------------------+----------------+
| user_profile_id | location | map_zoom_level |
+-----------------+---------------------------+----------------+
| 1 | @ @ | NULL |
+-----------------+---------------------------+----------------+
Can anyone help as to why I can't load my points? Is it a MySql problem?
Thanks in advance,
Ben
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---