Add newline display to project descriptions and annotation cards #47
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #46. I need to display formatted content, and this requires that I have newlines for my project description, tag/label descriptions and especially the annotation cards themselves.
The project detail template had to be altered to use the
linebreaks
option for the description. This was the only change required to make this work.To make the cards use newlines, I had to alter both front-end and back-end components.
StringIO
wrapper around the form to use thenewline=None
parameter for CSV/TSV types.\n
and\r
from the backenddjango.core.utils.util.create_data_from_csv
method.connection.cursor.copy_expert
with a raw SQL string I created that uses theCOPY FROM stdin WITH (FORMAT 'csv', DELIMITER E'\\t'
function of Postgres. It was not possible to generate the field list, sinceData._meta.get_fields()
returns more than the fields we need.\n
or\r
characters in the React card template into<br />
s, since newlines have no effect in HTML. The clean way to do this was to wrap each line of texts into its own<span>text<br/></span>
, so that is what I did.That was it! Now you can more richly format project descriptions and cards :)