Opened 15 years ago

Last modified 15 years ago

#12402 closed

Deferring geometry field causes invalid results or crash — at Initial Version

Reported by: Jani Tiainen Owned by: nobody
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: orm oracle defer
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If geometry field is not last and .defer('geom') is used results are populated incorrectly.

It seems that geometry field is always counted in fields in even it is marked as deferred.

class MyModel(models.Model):
    geom = models.PointField()
    num = models.IntegerField()

    objects = models.GeoManager()

>>> MyModel(geom=Geometry('POINT(10 10)'),num=1).save()
>>> my_objs = MyModel.objects.defer('geom').all()
>>> print my_objs
>>> []

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top