Any suggestions for this question?
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
Asif Jamadar
Sent: Thursday, October 27, 2011 11:33 AM
To: [email protected]
Subject: [BangPypers] Dynamic choices for django modelformset
How can I add dynamic choices for model formset?
Suppose I have model called TestModel
Class TestModel(models.Model)
dropdown_field = models.CharField(max_length=70, blank=True,
null=True, choices=' What to write here because my choices are dynamic')
And from this model I want to generate modelformset of 8 forms. So I will
generate 8 dropdownfields, those will have different choices.
I tried overriding the init method of BaseModelFormset and I generated dynamic
choices. But when I'm trying to submit these 8 forms I'm getting validation
error that "choices are not valid" because my model doesn't know about these
choices. So can I define choices for model?
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers