I am trying to 'fake out' a model form and display data from 2 columns
in one field. I can do this by returning the 2 columns in the model's
__unicode__ method, but I want to apply styling to the data - I want
one column's data left justified and the other column's data right
justified. When I return this in the __unicode__ method:
return mark_safe('<div style="float: left">%s</div><div style="float:
right">%s</div>' % (
self.name, self.group_by))
The HTML gets stripped out and I end up with just the data, e.g.:
<option value="1">12S target</option>
If I return the markup without the mark_safe, the HTML generated looks
like this:
<option value="1"><div style="float:
left">12S</div><div style="float:
right">target</div></option>
But what is displayed in the select box on the browser is:
<div style="float: left">12S</div><div style="float: right">target</div>
Does anyone know how I can do this?