Re: [Django] #15773: MultiValueField could be more convenient

2011-04-23 Thread Django
#15773: MultiValueField could be more convenient
-+-
   Reporter:  Aryeh  |  Owner:  nobody
  Leib Taurog | Status:  closed
   Type:  New|  Component:  Forms
  feature|   Severity:  Normal
  Milestone: |   Keywords:
Version:  1.3|  Has patch:  0
 Resolution:  needsinfo  |Needs tests:  0
   Triage Stage: |  Easy pickings:  0
  Unreviewed |
Needs documentation:  0  |
Patch needs improvement:  0  |
-+-
Changes (by jacob):

 * status:  new => closed
 * resolution:   => needsinfo


Comment:

 Without more info I don't see what the problem here is. If you can provide
 the use case or the problem that prompts this patch, please feel free to
 reopen.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #15773: MultiValueField could be more convenient

2011-04-21 Thread Django
#15773: MultiValueField could be more convenient
-+-
   Reporter:  Aryeh  |  Owner:  nobody
  Leib Taurog | Status:  new
   Type:  New|  Component:  Forms
  feature|   Severity:  Normal
  Milestone: |   Keywords:
Version:  1.3|  Has patch:  0
 Resolution: |Needs tests:  0
   Triage Stage: |  Easy pickings:  0
  Unreviewed |
Needs documentation:  0  |
Patch needs improvement:  0  |
-+-
Changes (by jacob):

 * needs_docs:   => 0
 * needs_tests:   => 0
 * easy:   => 0
 * needs_better_patch:   => 0


Comment:

 I'm not sure I get it. Can you share a specific use case or a problem you
 have that this solves?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



[Django] #15773: MultiValueField could be more convenient

2011-04-06 Thread Django
#15773: MultiValueField could be more convenient
---+---
 Reporter:  Aryeh Leib Taurog   | Owner:  nobody
 Type:  New feature|Status:  new
Milestone: | Component:  Forms
  Version:  1.3|  Severity:  Normal
 Keywords: |  Triage Stage:  Unreviewed
Has patch:  0  |
---+---
 It seems to me that the !MultiValueField could be a lot more useful.  I'm
 assuming the !SplitDateTimeField code exemplifies the normal use case, and
 I see two things here that bother me.

 1. To use !MultiValueField, coder '''must''' create and assign a widget
 class.  Maybe I'm just lazy because the other Field classes seem to
 provide reasonable defaults, but couldn't this field provide a reasonable
 default as well?

 2. `compress` must be defined on the Field class, but `decompress` must be
 defined on the Widget class.  I don't know if I'd call this a violation of
 DRY, but it seems to me it  would be much nicer to put these two together,
 since one is the inverse of the other.  Obviously there's nothing
 preventing me from putting my !MultiWidget subclass and !MultiValueField
 subclass together, but if I separate the Widgets from the Fields, as the
 django source has done, then I introduce room for maintenance errors.

 I guess this is mainly about convenience.  We '''do''' like making good
 development practice more convenient.

 My suggestion for addressing these two points is below.  Thanks for
 reading.

 {{{#!python
 from django.forms import fields
 from django.forms import widgets

 class MultiValueFieldWidgetDescriptor(object):
 def __get__(self, instance, owner):
 widget_base = getattr(owner, 'widget_base', widgets.MultiWidget)
 class MyWidget(widget_base):
 def __init__(self, attrs=None):
 widgets = [f.widget for f in instance.fields]
 super(MyWidget, self).__init__(widgets, attrs)

 decompress = owner.decompress.__get__(self)

 return MyWidget

 class MultiValueField(fields.MultiValueField):
 widget = MultiValueFieldWidgetDescriptor()
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.