#25591: Cannot QuerySet.update DateRangeField using F() expressions
-------------------------------+--------------------------------------
     Reporter:  synotna        |                    Owner:  nobody
         Type:  Uncategorized  |                   Status:  new
    Component:  Uncategorized  |                  Version:  1.8
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------

Comment (by jarshwah):

 I do think that `F()` objects make sense here, but they're going to have
 to go through a custom TypeRange() expression. We could and should handle
 this internally though. Users shouldn't need to know whether or not they
 need to import `XRange` from `psycopg` or from `contrib.postgres` based on
 whether or not they want to support F().

 I'm not intimately familiar with the contrib.postgres module, so I'm not
 sure if the psycopg2.extras.XRange types are usually imported by users or
 not.

 `RangeField` already has a `get_prep_value` which then wraps the values in
 the underlying `psycopg` types. It could inspect the content of `value`
 and then wrap inside a custom range_type_expression rather than
 range_type.

 This is just throwing ideas at a wall though. I'd be interested in what
 Marc Tamlyn has to say.

 Also, fwiw, your `DateRange` Func above does not need to define `template`
 as that's exactly the default anyway.

--
Ticket URL: <https://code.djangoproject.com/ticket/25591#comment:3>
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/065.fce17f35ebc372aafa732638efd1532a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to