INITIAL_CHOICE = ('', '---------')
class ProfileForm(forms.Form):
profile_id = forms.ChoiceField(label=_('Profile'), choices=[INITIAL_CHOICE])
def __init__(self, *args, **kwargs):
super(ProfileForm, self).__init__(*args, **kwargs)
self.fields["profile_id"].choices = [INITIAL_CHOICE]+[(obj.id, "%s [%s]" % (obj.name, obj.identity,)) for obj in Profile.objects.all()]
Tuesday, 14 May 2013
Django - Drop Down List Data Refresh/Reload
forms.py
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment