#26788: update of geometry field from the another one crashes
----------------------------+--------------------
     Reporter:  sir-sigurd  |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  GIS         |    Version:  1.9
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 {{{#!python
 class City(models.Model):
     point = models.PointField(srid=4326)
     point2 = models.PointField(srid=3857, null=True)
 }}}


 {{{#!python
 City.objects.update(point2=models.F('point'))
 }}}

 {{{#!python
 <ipython-input-7-e6630ea1824e> in <module>()
 ----> 1 City.objects.update(point2=models.F('point'))

 /home/sergey/dev/django/django/db/models/manager.pyc in
 manager_method(self, *args, **kwargs)
      83         def create_method(name, method):
      84             def manager_method(self, *args, **kwargs):
 ---> 85                 return getattr(self.get_queryset(), name)(*args,
 **kwargs)
      86             manager_method.__name__ = method.__name__
      87             manager_method.__doc__ = method.__doc__

 /home/sergey/dev/django/django/db/models/query.pyc in update(self,
 **kwargs)
     634         query.add_update_values(kwargs)
     635         with transaction.atomic(using=self.db, savepoint=False):
 --> 636             rows = query.get_compiler(self.db).execute_sql(CURSOR)
     637         self._result_cache = None
     638         return rows

 /home/sergey/dev/django/django/db/models/sql/compiler.pyc in
 execute_sql(self, result_type)
    1146         related queries are not available.
    1147         """
 -> 1148         cursor = super(SQLUpdateCompiler,
 self).execute_sql(result_type)
    1149         try:
    1150             rows = cursor.rowcount if cursor else 0

 /home/sergey/dev/django/django/db/models/sql/compiler.pyc in
 execute_sql(self, result_type)
     822             result_type = NO_RESULTS
     823         try:
 --> 824             sql, params = self.as_sql()
     825             if not sql:
     826                 raise EmptyResultSet

 /home/sergey/dev/django/django/db/models/sql/compiler.pyc in as_sql(self)
    1114             # Getting the placeholder for the field.
    1115             if hasattr(field, 'get_placeholder'):
 -> 1116                 placeholder = field.get_placeholder(val, self,
 self.connection)
    1117             else:
    1118                 placeholder = '%s'

 /home/sergey/dev/django/django/contrib/gis/db/models/fields.pyc in
 get_placeholder(self, value, compiler, connection)
     159         given value.
     160         """
 --> 161         return connection.ops.get_geom_placeholder(self, value,
 compiler)
     162
     163     def get_srid(self, obj):

 /home/sergey/dev/django/django/contrib/gis/db/backends/postgis/operations.pyc
 in get_geom_placeholder(self, f, value, compiler)
     338             value_srid = get_pgraster_srid(value)
     339         else:
 --> 340             value_srid = value.srid
     341
     342         # Adding Transform() to the SQL placeholder if the value
 srid

 AttributeError: 'Col' object has no attribute 'srid'
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26788>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.fef79ec8c055ada63f4f9172414ab8c5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to