Hi,

On Fri, 20 Jun 2008 20:42:57 +0200, diggs <[EMAIL PROTECTED]> wrote:

> Thanks. It's actually the importing part that I don't know how to do.
>
assuming you have:

models.py:

ROLES = (
        whatever
)


views.py:

import models

models.ROLES


and since you are probably interacting with your models in your views,
you should already have an import statement for your models.

adi


> On Jun 20, 2:29 pm, "Richard Dahl" <[EMAIL PROTECTED]> wrote:
>> sure, its just python:
>> for r in ROLES:
>>     r[0] #retrieves 'Associate' the first iteration
>>     r[1] # also retrieves 'Associate'
>>
>> You just need to ensure that ROLES is imported into your views.
>> hth,
>> -richard
>>
>> On 6/20/08, diggs <[EMAIL PROTECTED]> wrote:
>>
>>
>>
>> > Hello,
>>
>> > I've defined a set of choices in my model.py file that are used in a
>> > particular model via the CHOICE arg. Is it possible to access these
>> > values from a view to populate a random select list? In models:
>>
>> > ROLES = (
>> >    ('Associate', 'Associate'),
>> >    ('Role 2', 'Role2'),
>> > )
>>
>> > I don't want to have to redefine them or hard-code them into the view.
>>
>> > Thanks,
>> > Phillip
> 


-- 
Adi J. Sieker         mobile: +49 - 178 - 88 5 88 13
Freelance developer   skype:  adijsieker
SAP-Consultant        web:    http://www.sieker.info/profile
                       openbc: https://www.openbc.com/hp/AdiJoerg_Sieker/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to