id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 2244,'Hitting returns' in template files are interpreted as NewLines while I want it interpreted as nothing,chengqi@…,Adrian Holovaty,"= introduction = hi, I am trying to use django's view-template to export some contents to a text files with some format, e.g. carriage return, indentionh etc. But seems every control statement of django templte(if/for/else) are all interpreted as new lines in the exported TXT files, which make my exported files ugly. The followings are my code related: = code = * views {{{ !#python categories = Category.objects.filter(field__in=request.POST.getlist(""categories"")) limits = request.POST.getlist(""category_limits"") response = HttpResponse(mimetype=""text/csv; charset=utf-16-be"") response[""Content-Disposition""] = ""attachment; filename=indesign_export.txt"" template = loader.get_template(""indesign_export.txt"") context = viewdata(city, categories, limits) response.write(unicode(template.render(context), ""utf-8"").encode(""utf-16-be"")) return response }}} * templates indesign_export.txt {{{ {% for category in categories %} {% for subcategory in category.subcategories %} {% for listing in subcategory.listings %} {% if listing.english_menu_ok %} English menu, {% endif %} {% if listing.wifi_ok %} Wi-Fi internet, {% endif %} {% endfor %} {% endfor %} {% endfor %} }}} * Currently what resolution I have is not using Templare.reder(), I mean writing the contents directly to a file, whose content will be outputed as HttpResponse('file_content'). But this violates the MVC priciples, no VIEW, that is templates in django. * So I think this is a bug of the template system. Thanks.",defect,closed,Template system,dev,normal,invalid,,,Unreviewed,0,0,0,0,0,0