#24170: DateTimeRangeField: widget doesn't implement decompress()
-------------------------------------+-------------------------------------
     Reporter:  joelburton           |                    Owner:  ngzhian
         Type:  Uncategorized        |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.8alpha1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  DateTimeRangeField   |             Triage Stage:  Accepted
  decompress                         |
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by charettes):

 * stage:  Unreviewed => Accepted


Comment:

 I think creating a single `RangeWidget(widgets.Widget)` class in a new
 `widgets` module that implements the decompress method should do.

 {{{#!python
 # django/contrib/postgres/widgets.py

 class RangeWidget(widgets.Widget):
     def __init__(base_widget, attrs=None):
         widgets = (base_widget, base_widget)
         super(RangeWidget, self).__init__(widgets, attrs=attrs)

     def decompress(self, value):
         if value:
           return (value.lower, value.upper)
         return (None, None)
 }}}


 Please make a
 [https://docs.djangoproject.com/en/dev/internals/contributing/writing-code
 /working-with-git/#publishing-work PR] of your patch to make review
 easier. Thanks!

--
Ticket URL: <https://code.djangoproject.com/ticket/24170#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/068.411baaa5b8c0de68fd4bfcb839448cc4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to