I am having trouble rendering individual fields in my template. I have a custom form that renders a multichoice widget and Charfield. I want to render the widget and Charfield individually, so I can place the Charfield on the right of the widget rather than on the bottom (which is what Django does by default). Is there a way to call individual fields in my form in the template?
forms.py
class UpdateStateOptionWithOutcomesForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
disease=kwargs.pop('disease', None)
super(UpdateStateOptionWithOutcomesForm, self).__init__(*args, **kwargs)
self.fields['relevantoutcome']=forms.ModelMultipleChoiceField(queryset=Outcome.objects.filter(relevantdisease_id=disease),required=True, widget=forms.CheckboxSelectMultiple)
self.fields['relevantoutcome'].label="Treatment Outcomes"
outcome_qs=Outcome.objects.filter(relevantdisease_id=disease)
for outcome in outcome_qs:
self.fields['outcomevalue_%s' % outcome.pk] = forms.CharField(required=False)
self.fields['outcomevalue_%s' % outcome.pk].label = "Outcome Value"