0

I have a queryset using which I want to display values of a certain field.

   {% for pm in paymentmethods %}
      {{pm.get_payment_method_display}}
   {% endfor %}

This works fine but it adds lots of extra space per get_payment_method_display.

This is how it ends up looking like:

enter image description here

How do i get rid of the extra white space and just show each item in a new line.

This is how my pre css class looks like:

pre {
    white-space: pre-wrap;       /* Since CSS 2.1 */
    white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
    white-space: -pre-wrap;      /* Opera 4-6 */
    white-space: -o-pre-wrap;    /* Opera 7 */
    word-wrap: break-word;       /* Internet Explorer 5.5+ */

}
Asdfg
  • 11,362
  • 24
  • 98
  • 175

1 Answers1

0

You can use .strip to strip the white space. {{ var.example.strip }} Here is a post about trimming white space and tags.

Taylor
  • 1,223
  • 1
  • 15
  • 30