#25708: cannot annotate with geometry value
----------------------------+--------------------------------------
     Reporter:  sir-sigurd  |                    Owner:  sir-sigurd
         Type:  Bug         |                   Status:  assigned
    Component:  GIS         |                  Version:  1.8
     Severity:  Normal      |               Resolution:
     Keywords:              |             Triage Stage:  Accepted
    Has patch:  1           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+--------------------------------------

Comment (by sir-sigurd):

 Replying to [comment:11 jarshwah]:

 > The `output_field` is only really responsible for converting the value
 returned from the database into a useable model field, it doesn't take
 responsibility for serialising the value to be sent to the database.

 This doesn't seem to be true, `output_field.get_db_prev_value()` is used
 in `Value.as_sql()`
 
[https://github.com/django/django/blob/93452a70e8a62c7408eeded444f5088d4a26212d/django/db/models/expressions.py#L573
 (GitHub)]:
 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!python
     def as_sql(self, compiler, connection):
         connection.ops.check_expression_support(self)
         val = self.value
         # check _output_field to avoid triggering an exception
         if self._output_field is not None:
             if self.for_save:
                 val = self.output_field.get_db_prep_save(val,
 connection=connection)
             else:
                 val = self.output_field.get_db_prep_value(val,
 connection=connection)
         if val is None:
             # cx_Oracle does not always convert None to the appropriate
             # NULL type (like in case expressions using numbers), so we
             # use a literal SQL NULL
             return 'NULL', []
         return '%s', [val]
   }}}
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25708#comment:12>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b1486349ff4e32205066c511a5268755%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to