Hi All,
I need to create a field with a choice set that looks like this:
BTW_CHOICES = (
('0.0', '0%'),
('6.0', '6%'),
('19.0', '19%'),
)
This works as expected when using dropdown lists in a form. But it needs to be
build from data in another model. When needed in a view I can retrieve the raw
data like this:
btwchoices = Meta.objects.values_list('value',
'display').filter(attribute__startswith='BTW')
When I put a similar line in the model class Meta is unknown. And doing a 'from
models import...' seems very weird when I'm IN the models module. when I move
it to a myfunctions.py I get import errors.
from models import Meta
ImportError: cannot import name Meta
Can anybody give me some insights on how, and more importantly where, to
dynamically fill this BTW_CHOICES thingy.
Thanx!
Regards,
Gerard.
--
urls = { 'fun': 'www.zonderbroodje.nl', 'tech': 'www.gp-net.nl' }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---