Ticket #599 (assigned defect)
PointField error
| Reported by: | typeshige | Owned by: | andrew |
|---|---|---|---|
| Priority: | major | Milestone: | 1.0 |
| Component: | commands | Version: | unknown |
| Keywords: | Cc: |
Description
I'm trying to convert some geodjango models to South.
I got this error:
File "/home/django/applications/nims-groups/groups/migrations/0001_initial.py", line 29
('point', self.gf('django.contrib.gis.db.models.fields.PointField?')(default=<Point object at 0x20965b0>, null=True, blank=True)),
SyntaxError?: invalid syntax
The pointer starts at "<Point object..."
Thanks and congrats on the commit bit for Django!
Attachments
Change History
comment:2 follow-up: ↓ 3 Changed 2 years ago by woolford.thomas@…
default=<Point object at 0x20965b0>
Is this literally in the code? This is not valid python. It looks like you pasted the output of repr(point_object) into your code...
comment:3 in reply to: ↑ 2 Changed 2 years ago by andrew
- Status changed from new to assigned
- Milestone set to 1.0
Replying to woolford.thomas@…:
default=<Point object at 0x20965b0>Is this literally in the code? This is not valid python. It looks like you pasted the output of repr(point_object) into your code...
That's what I said in the original comment, basically - South doesn't know how to freeze this GDAL object so it just repr()s it.
comment:4 Changed 2 years ago by woolford.thomas@…
Ah i see, this was autogenerated. Disregard my confusion.
comment:6 Changed 7 weeks ago by Val Neekman <un33kvu@…>
Just add the default value as text as such:
point = models.PointField?(_('Point'), default='POINT(0.0 0.0)')
That will take care of migration and allows you to continue.
comment:7 Changed 7 weeks ago by Val Neekman <un33kvu@…>
The comment submission added a "?" after the PointField? which should be removed.

We don't support defaults for PointFields? yet - freezing the GDAL objects is difficult. I'd recommend making it nullable, and if you're adding it into an existing model, looping over and adding in the default value manually, then altering it to be non-nullable.
Don't worry about future rows; Django handles the default value, it's not something that needs to go to the database.
If you like, we can leave this bug open and retitle it "GDAL objects should be freezeable".