Here is an example of get_choices() output ... it comes from a method on
the Question model.
[('A', 'A - Once?'), ('B', 'B - Twice?'), ('C', 'C - Four times?'),
('D', 'D - Twelve times?'), ('E', 'E - Continously as changes are made?')]
It is available before the the answer form is instantiated ...
class AnswerSingleForm(forms.ModelForm):
class Meta:
model = Answer
fields = [
'answer',
'score'
]
So how do I get that set of choices into the Answer form?
I can see from the docs that the form Meta class can have a widgets
attribute for the 'answer' field. I think I need a ChoiceField widget so
I can include the choices. I tried using __init__() in the form class to
get the choices on board at instantiation but still couldn't get it
going because class Meta doesn't see 'self'.
Thanks for any help
Stumped
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/0784c79f-81fb-6a88-b7f6-cbdbcec552fe%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.