Accessing django choice field
Posted
by Hulk
on Stack Overflow
See other posts from Stack Overflow
or by Hulk
Published on 2010-04-01T06:36:24Z
Indexed on
2010/04/01
6:43 UTC
Read the original article
Hit count: 464
there is a module as header ,
from test.models import SEL_VALUES
class rubrics_header(models.Model):
sel_values = models.IntegerField(choices=SEL_VALUES)
So when SEL_VALUES is imported from test.modules.What is the code that has to go in views to get the choices in sel_values . And the test.modules has the following,
class SEL_VALUES:
vaue = 0
value2 = 1
class Entries(forms.Form) :
models.IntegerField(choices=SEL_VALUES)
SEL_VALUES = ((ACCESS.value,'NAME'),(ACCESS.value2,'DESIGNATION'))
© Stack Overflow or respective owner