I'm working on my first Django project and I can't seem to get
information printed out as I would like it. I'm trying to print out
quotes to a page with the newlines turned into HTML <br> tags (similar
to PHP's nl2br function). So far I've been able to do this using the
__str__ function for the Quote model, but it escapes the tags into
html entities that I see the tags in my browser instead of the line
breaks. I'm using the development version of Django.

Here's what my __str__ function looks like:

return self.quote.replace('\n', '<br />')

And I'm just printing them out with a generic view that looks like
this:

    {% for quote in object_list %}
        <div class="quote">{{ quote }}
          <div class="caption" align="right">
          {% for a in quote.authors.all %}
                  &mdash;{{ a }}<br />
          {% endfor %}
          </div>
        </div>
    {% endfor %}

I'd appreciate any suggestions. I'm rather new to Python, so I
appreciate all the help I can get :)

--Alex
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to