djangosnippets.org: Latest snippets tagged with 'httpresponse'https://djangosnippets.org/tags/httpresponse/2014-05-05T05:34:45.742343-05:00ExcelResponse2
2014-05-05T05:34:45.742343-05:00Hackathonhttps://djangosnippets.org/snippets/3046/<p>A function extends of Tarken's django-excel-response</p>
<p>django-excel-response
1、djangosnippets - http://djangosnippets.org/snippets/1151/
2、pypi - https://pypi.python.org/pypi/django-excel-response/1.0</p>
<p>When using Tarken's django-excel-response. We find that
Chinese is messed code when we open .xls in Mac OS.
As discussed in http://segmentfault.com/q/1010000000095546.
We realize django-excel-response2
Based on Tarken's django-excel-response to solve this problem
By adding a Param …</p>
Freely redistributableDoing redirect without request
2010-09-23T08:55:10.918970-05:00divermanhttps://djangosnippets.org/snippets/2204/<p>When you neeed to do redirect and request object is not available, you can do it with exception.</p>
<p>Put exception handler somewhere request is available, for example to middleware or ModelAdmin.</p>
<p>Raise exception, where request is not available.</p>
Freely redistributableExcelResponse
2008-10-23T10:06:48.271347-05:00Tarkenhttps://djangosnippets.org/snippets/1151/<p>A subclass of <code>HttpResponse</code> which will transform a <code>QuerySet</code>, or sequence of sequences, into either an Excel spreadsheet or CSV file formatted for Excel, depending on the amount of data. All of this is done in-memory and on-the-fly, with no disk writes, thanks to the StringIO library.</p>
<p><strong>Requires:</strong> <a href="http://pypi.python.org/pypi/xlwt/">xlwt …</a></p>
Freely redistributable401 HttpResponse
2008-06-18T11:02:59.866540-05:00Davidhttps://djangosnippets.org/snippets/813/<p>This is a HTTP response is use in my application when I want to return a 401.</p>
<p>It's pretty simple, but effective for my needs.</p>
Freely redistributable