Currently, I am managing a text-field in Django through Django-admin which requires maintaining white-space integrity. To achieve this, I am encapsulating it within <pre> </pre>
tags for rendering with the assistance of vueJS
and vue-material
.
Through this method, the white-space is correctly preserved, even when inspecting the descrip
field of my model manually via the python manage.py shell
confirming that the white-space exists in the database.
https://i.sstatic.net/SlKNY.png
Mysteriously, there seems to be an additional leading white-space tab at both the beginning and end of my HTML when rendered, as seen here:
https://i.sstatic.net/LCLLW.png
This extra space is also visible in the HTML snippet provided below:
https://i.sstatic.net/oOkLx.png
Here are the relevant sections of code:
relevant html and css
<md-layout md-column md-flex-xsmall="100" md-flex-small="55"
md-flex-medium="70" md-flex-large="80" id="summary_block">
<md-layout >
<pre class="md-body">
[[ product.descrip ]]
</pre>
</md-layout>
</md-layout>
#summary_block > div.md-layout > pre {
white-space: pre-wrap;
word-wrap: break-word;
font-family: inherit;
}
Is this possibly related to a postgres
issue? If so, why does the white-space not appear when examining object.descrip
in the python shell?
My tech stack includes postgres
, vuejs
, django
version 1.10
, python 3.5
, and vue-material
.