python - make ChoiceField() take any value -


i'm using forms framework , i'm using of javascript magic inject values on fly select box (the values of select box relies on value form another).

basically have team , players. need define player, players data comes team.

in form class have

team = forms.modelchoicefield(queryset=team.objects.all() player = forms.choicefield() 

in front end when user selects team select box, (empty) players boxes gets correctly updated new data. when hit submit, player select box throws error select valid choice. 2 not 1 of available choices. 2 valid choice however.

is there way around this? can make choicefield() take value?

ordered complexity desc:

  1. prepopulate possible choices. example, if select player's id, choices = player.objects.values_list('id', flat=true)
  2. define charfield, render manually in template select box.
  3. don't define in form, pass it's value form's constructor (which need override process value.)

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -