Message from discussion newforms-admin: defaults and radio select
Received: by 10.35.73.10 with SMTP id a10mr1016399pyl.1184013283876;
Mon, 09 Jul 2007 13:34:43 -0700 (PDT)
Received: by g4g2000hsf.googlegroups.com with HTTP;
Mon, 09 Jul 2007 20:34:42 +0000 (UTC)
From: _ <allen.ridd...@gmail.com>
To: Django users <email@example.com>
Subject: Re: newforms-admin: defaults and radio select
Date: Mon, 09 Jul 2007 13:34:42 -0700
X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:126.96.36.199) Gecko/20061201 Firefox/188.8.131.52 (Ubuntu-feisty),gzip(gfe),gzip(gfe)
Content-Type: text/plain; charset="iso-8859-1"
Thanks for the code, I'll give it a shot.
As for initial values, I'm thinking about the add form. I'm sorry, I
should have said.
On Jul 9, 1:23 pm, leifbyron <leifstrickl...@gmail.com> wrote:
> Hi Allen,
> The RadioSelect widget is actually one of the more complicated ones in
> newforms. Its render method returns a RadioFieldRenderer object, which
> in turn utilizes the RadioInput widget. The problem with using a
> RadioSelect widget in newforms-admin is that the template is expecting
> each widget to produce a unicode string, not a non-string object. So
> when the RadioSelect widget returns a RadioFieldRenderer object to the
> template, an error is triggered.
> Luckily, this problem is easy to fix by subclassing RadioSelect like
> class AdminRadioSelect(forms.widgets.RadioSelect):
> def render(self, name, value, attrs=None, choices=()):
> renderer =
> return renderer.__unicode__()
> This, of course, is pretty hackish. I am not sure if a ticket is open
> to solve this problem. But at least this code suffices for now.
> As for initial values ... are you referring to the values of a saved
> object as rendered on a change form, or the default values (as defined
> in the model) on the add form?