On Feb 19, 10:18 pm, "Justin Findlay" <[EMAIL PROTECTED]> wrote:
> On Jan 25, 1:16 pm, "canen" <[EMAIL PROTECTED]> wrote:
>
> > Answering my own question:
> Thanks for the example!
I created another, but it uses initial data, and an object
representing the info.
class Postal(object):
def _
On Feb 19, 1:18 pm, "Justin Findlay" <[EMAIL PROTECTED]> wrote:
> Canen, do you have the time to work out a full example? After much
> trying I'm still not able to repeat the example without having to use
> the double tuple values.
Nevermind. I misunderstood what you meant by repeating choices.
On Jan 25, 1:16 pm, "canen" <[EMAIL PROTECTED]> wrote:
> Answering my own question:
>
> The widget can be declared as part of the field, e.g.
>
> # Field
> class MoneyField(MultiValueField):
> def __init__(self, currency=(), amount=(), required=True,
> widget=None, label=None, initial=None):
>
Thanks for the pointers. I soon came to realise that I did indeed need to
subclass the MultValue classes, and currently have something like this:
class PostcodeField(forms.MultiValueField):
def compress(self, data_list):
return ''.join(data_list)
class PostcodeWidget(forms.MultiWidget):
Phil,
Thought an example might help.
class VacationBudgetField(MultiValueField):
def __init__(self, required=True, label=None, widget=None,
initial=None, f_type=(), currency=(), amount=None):
fields = (ChoiceField(choices=f_type),
ChoiceField(choices=currency), IntegerField())
Phil,
I think you must subclass it and define the compress method. See the
comments here http://code.djangoproject.com/browser/django/trunk/
django/newforms/fields.py#L412. You will also need a MultiWidget to
go with the field.
On Feb 6, 10:04 am, "Phil Powell" <[EMAIL PROTECTED]> wrote:
> Hi,
Hi,
Can anyone provide any pointers on how I use MultiValueField? Can I
use it straight out of the box, or do I have to subclass to create a
new field and a new MultiValueWidget?
I thought that this code would just work:
postcode = forms.MultiValueField(fields=(forms.CharField(max_length=4),
f
Answering my own question:
The widget can be declared as part of the field, e.g.
# Field
class MoneyField(MultiValueField):
def __init__(self, currency=(), amount=(), required=True,
widget=None, label=None, initial=None):
widget = widget or MoneyWidget(currency=currency,
amount=amou
Hello All,
I am resending this -- seems it didn't reach the last time, sorry if it
turns up twice
I've been messing around with the new MultiValueField and MultiWidget.
I don't know if the shortcoming is with me or with the implementation
of the field and widget. Let's say I want t
9 matches
Mail list logo