#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:
  decompress                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by ngzhian):

 Error is caused because all the new fields added in 1.8
 `IntegerRangeField`, `FloatRangeField`, `DateTimeRangeField`, and
 `DateRangeField`, all inherit from `BaseRangeField`.

 `BaseRangeField` itself defines its widget as
 `forms.MultiWidget([self.base_field.widget, self.base_field.widget])`
 
[https://github.com/django/django/blob/master/django/contrib/postgres/forms/ranges.py#L18
 postgres.forms.ranges.py#18]. However, `MultiWidget` raises `
 NotImplementedError('Subclasses must implement this method.')` just like
 @joelburton mentioned.

 I'm not sure how to patch this. Thinking that:
 1. Each of the child classes of `BaseRangeField` should overwrite
 `__init__` to put in their own widgets.
 2. create a new `widgets.py` file in `contrib.postgres` to define the new
 widgets.

 Comments?

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

Reply via email to