#17448: Error reading PointField in objects.raw(sql) query
-----------------------------+------------------------------------
     Reporter:  oluckyman    |                    Owner:  nobody
         Type:  Bug          |                   Status:  reopened
    Component:  GIS          |                  Version:  1.3
     Severity:  Normal       |               Resolution:
     Keywords:  raw sql gis  |             Triage Stage:  Accepted
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  0            |                    UI/UX:  0
-----------------------------+------------------------------------

Comment (by DavidEklund):

 This works for me, I can't reproduce this bug.

 Which database was used when coming across the bug?

 I'm using:

 OS: Ubuntu 12.04.

 Database backend: Postgis.

 My setup is an app named placeapp with the following model in it:

 {{{
 from django.contrib.gis.db import models

 class Place(models.Model):
     location = models.PointField(srid=4326)
     objects = models.GeoManager()
 }}}

 Then I get the following in a shell:

 {{{
 >>> from placeapp.models import Place
 >>> from django.contrib.gis.geos import Point
 >>> q = Point(1,2)
 >>> p = Place()
 >>> p.location = q
 >>> p.save()
 >>> Place.objects.raw('select * from placeapp_place')[0].location
 <Point object at 0x3526f40>
 }}}

 And also:

 {{{
 >>> Place.objects.raw(u'select * from placeapp_place')[0].location
 <Point object at 0x33ae0a0>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17448#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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 https://groups.google.com/groups/opt_out.


Reply via email to