Thanks guys,
Person._meta.get_field('height').get_choices()
worked just fine. Needed it for my custom manipulator.
Regards,
Mike
On 1/16/06, Mike <[EMAIL PROTECTED]> wrote:
>
> How do I do that? To retrieve a field's choices from the model?
>
> class Person(meta.Model):
> height = meta.CharField(maxlength=100,
> choices=(('tall','Tall'),('short','Short')))
>
> >>> Person.height.choices #
In the magic removal branch
How about creating a method in the model (untested!)
def mychoices(self):
return self.choices
then its
>>> a = Person.get_list()
>>> a[0].choices()
(I think)
Cheers,
Tone
How do I do that? To retrieve a field's choices from the model?
class Person(meta.Model):
height = meta.CharField(maxlength=100,
choices=(('tall','Tall'),('short','Short')))
>>> Person.height.choices #
Thanks,
Mike
4 matches
Mail list logo