djangosnippets.org: Latest snippets posted by Tarkenhttp://djangosnippets.org/users/Tarken/2008-10-30T11:25:27.670660-05:00Tarkendjango-pyodbc MoneyField
2008-10-30T11:25:27.670660-05:00Tarkenhttp://djangosnippets.org/snippets/1161/<p>This is a very small, simple piece of code, but essential for using fields of type 'money' on MS SQL Server, through FreeTDS. This took me quite some time to hunt down, as get_placeholder() is in fact an undocumented feature.</p>
<p><strong>Example:</strong></p>
<pre><code>class MyModel(models.Model):
price = MoneyField()
</code></pre>
Freely redistributableExcelResponse
2008-10-23T10:06:48.271347-05:00Tarkenhttp://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 redistributable