Re: cache problem of new forms: make ChoicesField's choices list on fly

2007-04-23 Thread hoamon
thanks for dball's comments. i rewrite myproject/form.py in your way, and user can get the new Choices list. but when they submit to the server. they will get the error message: [Select a valid choice. That choice is not one of the available choices.] so i just move CancelForm from form.py to

Re: cache problem of new forms: make ChoicesField's choices list on fly

2007-04-23 Thread dballanc
Sorry, first post had an error. class CancelForm(forms.Form): name = forms.CharField(label="name", max_length=10) no = forms.CharField(label="personalid", max_length=10) unit = forms.ChoiceField(label="unitname", choices=[]) def __init__(self,*args,**kwargs):

Re: cache problem of new forms: make ChoicesField's choices list on fly

2007-04-23 Thread Robert
On 23 Kwi, 15:44, hoamon <[EMAIL PROTECTED]> wrote: > Hi there~ > > I have a ChoiceField() of [newforms] in CancelForm, > it's choices list is depending on database table sign2. > my source code is below. > > -- > from django import newforms as forms > class CancelForm(forms.Form): > U_hash =

cache problem of new forms: make ChoicesField's choices list on fly

2007-04-23 Thread hoamon
Hi there~ I have a ChoiceField() of [newforms] in CancelForm, it's choices list is depending on database table sign2. my source code is below. -- from django import newforms as forms class CancelForm(forms.Form): U_hash = {} for U in Sign2.objects.all(): U_hash[U.unit.id] =