On Saturday, 22 November 2008 03:52:27 Jeff FW wrote:
> choices = Movie._meta.get_field('disk_type').choices
Ah, the 'Movie' in there was the missing voodoo. I was stuck on using an
instance; and yes, I prefer Movie dot choices 'global' idea.
Thanks for the various replies. I have more-or-less g
You could define the CHOICES as a member of your model class, like so:
class Movie( Relic ):
CHOICES=((u'1','one'), (u'2',u'two'))
disk_type = models.CharField( 'Type', max_length=8,
choices=CHOICES)
Then, in your form:
class MovieForm( BasicRelicForm ):
disk_type = forms.CharField(
On Friday, 21 November 2008 13:46:35 Daniel Roseman wrote:
> There is an alternative, though: instead of overriding the fields
> declaratively, you can define a formfield_callback function.
This seems interesting. I have searched the docs online
for 'formfield_callback' and get no useful results
On Nov 21, 9:09 am, Donn <[EMAIL PROTECTED]> wrote:
> On Friday, 21 November 2008 08:06:32 urukay wrote:
>
> > easy way how to solve it is to put definition of your choices out of model
> > definition:
>
> Yeah, that's what I call a 'global', but is there no way to get the choices
> from the field
gt; \d
>
> >
>
>
--
View this message in context:
http://www.nabble.com/Custom-Select-widget-choices---how-to-reuse-choices--tp20606743p20617654.html
Sent from the django-users mailing list archive at Nabble.com.
--~--~-~--~~~---~--~~
You received
On Friday, 21 November 2008 08:06:32 urukay wrote:
> easy way how to solve it is to put definition of your choices out of model
> definition:
Yeah, that's what I call a 'global', but is there no way to get the choices
from the field in the model class?
\d
--~--~-~--~~~-
;
> I could use a global var and repeat it twice, but I'd like to know if
> there's
> a way to simply 'fetch' it from the model.
>
> Any clues?
> \d
>
> >
>
>
--
View this message in context:
http://www.nabble.com/Custom-Select-widget-c
Hello,
In my model, I define the choices for a charfield. I make a ModelForm of that
model but I want my own widget for that field. How can I pass-through the
choices I defined in my model?
Some code:
class Movie( Relic ):
disk_type = models.CharField( 'Type', max_length=8, choices=((u'1','on
Christian Markwart Hoeppner wrote:
> I just noticed that it needs an iterable ot two-tuples. I wonder if
> there's a way to automate the creation of such a sequence, when I need a
> numbered sequence. Something like "for i in range(): list.push((i,i))"
> or so? I'm pretty new to python :)
Perhaps
El mar, 24-04-2007 a las 14:28 +1000, Malcolm Tredinnick escribió:
> On Mon, 2007-04-23 at 17:26 +0100, Christian Markwart Hoeppner wrote:
> > El lun, 23-04-2007 a las 21:22 +1000, Malcolm Tredinnick escribió:
> > > On Mon, 2007-04-23 at 12:17 +0100, Christian Markwart Hoeppner wrote:
> > > > Hi t
On Mon, 2007-04-23 at 17:26 +0100, Christian Markwart Hoeppner wrote:
> El lun, 23-04-2007 a las 21:22 +1000, Malcolm Tredinnick escribió:
> > On Mon, 2007-04-23 at 12:17 +0100, Christian Markwart Hoeppner wrote:
> > > Hi there!
> > >
> > > When explicitly defining a field to use a Select widget,
El lun, 23-04-2007 a las 21:22 +1000, Malcolm Tredinnick escribió:
> On Mon, 2007-04-23 at 12:17 +0100, Christian Markwart Hoeppner wrote:
> > Hi there!
> >
> > When explicitly defining a field to use a Select widget, how do I assign
> > choices to the dropdown?
> >
> > My last attempt:
> > age
On Mon, 2007-04-23 at 12:17 +0100, Christian Markwart Hoeppner wrote:
> Hi there!
>
> When explicitly defining a field to use a Select widget, how do I assign
> choices to the dropdown?
>
> My last attempt:
> age = forms.IntegerField(label=_('Age'), widget=widgets.Select,
> choices=range(25,90))
Hi there!
When explicitly defining a field to use a Select widget, how do I assign
choices to the dropdown?
My last attempt:
age = forms.IntegerField(label=_('Age'), widget=widgets.Select,
choices=range(25,90))
--~--~-~--~~~---~--~~
You received this message bec
14 matches
Mail list logo