I have the following field in a Form:
<div class="form-group ">
<div class="input-group">
<input class="form-control" id="To" name="To" placeholder="To" type="text"/>
<i class="glyphicon glyphicon-map-marker form-control-feedback"></i>
</div>
</div>
which looks like
and I am trying to have a similar result using crispy-forms
.
I tried
self.helper.layout = Layout(
Fieldset(
'Title',
PrependedText(
'From',
<i class="glyphicon glyphicon-map-marker"></i>
),
'To',
'Date',
ButtonHolder(
Submit('submit', 'Search', css_class='button white')
)
)
)
but I get a SyntaxError: invalid syntax
.
Is it possible to add an icon as PrependedText in crispy-forms
?
If not, is there any alternative?
(Edit)
Trying
self.helper.layout = Layout(
Field(PrependedText('From', HTML('<span class="glyphicon glyphicon-map-marker"></span>')), placeholder='From'),
'To',
'Date',
ButtonHolder(
Submit('submit', 'Search', css_class='button white')
)
)
does not raise any error, but no icon is shown.