1. Realize that no all line boundaries are "\r\n'. 2. You might try passing in "\r\n" in a template variable in case the filter argument handling isn't processing the backslashes: render...(...{...newline:"\r\n",...}) in the view, or in the extra context in the urls.py if you're using generic views, and then {{ text|cut:newline }}
3. If 2 works on some but not all newlines (see 1) you could pass two template variables, cr and lf, and do {{ text|cut:cr|cut:nl }}. 4. If you're not using generic views, you can always strip the line boundaries in the view: text=text.replace("\r\n","") 5. You can always write a custom filter. 6. You probably actually want to replace the line boundary with a space, rather than cut it, since otherwise you may run words together. Bill On Thu, Sep 10, 2009 at 2:47 PM, EricR86 <notthebmovieac...@gmail.com> wrote: > > Hello, > > I was wondering if it was at all possible to remove line breaks from a > text passed in from a template variable. Ideally I'd like to do > something like: {{ text|cut:"\r\n" }} , but that doesn't seem to work. > I've tried googling and searching on the mailing list with no results. > > Thanks for your time in advance, > > - Eric > > > --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---