I have a form wizard that I have another URL that allows a user to edit the form, populating it with data in the database. It seems to work fine for all CharFields, but will the change the selected, (value) of the CharField with forms.Select() widget to reflect the value. All other form rows in the form set are populated correctly.
output of the dict to be returned
resources dict:
[ { 'res_details': u'Sniper Rifle',
'res_justification': u'Shooting',
'res_task': <Task: Obtain Sniper Rifle>},
{ 'res_details': u'Vantage Point',
'res_justification': u'Succeeding',
'res_task': <Task: Shoot her>}]
Notice in the second row, the select box is not reflecting the respective
'res_task': <Task: Shoot her> and is instead just defaulting to the first index.
models.py
class Resources_Required_Form(forms.Form):
res_details = forms.CharField(required=True)
res_justification = forms.CharField(required=True,)
res_task = forms.CharField(
required=True, widget=forms.Select()
)
wizard.py
def get_form_initial(self, step):
..
elif step == 'deliverable':
project_id = self.kwargs['project_id']
project = Project.objects.get(pro_id=project_id)
deli_dict = [{
'deli_description': d.deli_description
} for d in Deliverable.objects.filter(project=project)]
print "deliverables dict:"
pp.pprint(deli_dict)
print "----"
return deli_dict
..

