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
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 =
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
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
>
--
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 this message because
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
ly 'fetch' it from the model.
>
> Any clues?
> \d
>
> >
>
>
--
View this message in context:
http://www.nabble.com/Custom-Select-widget-choices---how-to-reuse-choices--tp20606743p20615699.html
Sent from the django-users mailing list archive at Nabble.com.
--~--~---
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,
8 matches
Mail list logo