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

Reply via email to