djangosnippets.org: Latest snippets posted by kinghttp://djangosnippets.org/users/king/2009-03-17T13:55:44.801788-05:00kingLoad template from specific app
2009-03-17T13:55:44.801788-05:00kinghttp://djangosnippets.org/snippets/1376/<p>You can use this template loader if you want to use template specifically from one app. Useful mainly in overriding admin templates - just make your own <code>admin/change_form.html</code> and have it extend <code>admin:admin/change_form.html</code> withou creating any symlinking or copying django admin's templates to alternate location.</p>
<p>Part of the <a href="http://www.ellaproject.cz/">ella project …</a></p>
Freely redistributableEditInline for GenericForeignKey
2008-05-20T15:19:03.645247-05:00kinghttp://djangosnippets.org/snippets/765/<p>A simple InlineModelAdmin class that enables you to edit models that are bound by the instance via a generic foreign key (<code>content_type</code>, <code>object_id</code> pair)</p>
<p>Use like:</p>
<pre><code>class PlacementInlineOptions( generic.GenericTabularInline ):
model = Placement
extra = 2
ct_field_name = 'target_ct'
id_field_name = 'target_id'
</code></pre>
<p>Can be also found at #4667</p>
Freely redistributableWizard class
2007-05-09T07:23:46.312531-05:00kinghttp://djangosnippets.org/snippets/222/<p>Wizard class - subclass this, supply a done() method and then you can use <code>MyWizard( [list, of, newforms, classes])</code> as a view function.</p>
<p>see <a href="http://code.djangoproject.com/ticket/3218">#3218</a></p>
Freely redistributableCreate OpenOffice documents
2007-02-25T20:21:56.346081-06:00kinghttp://djangosnippets.org/snippets/15/<p>This view will enable you to generate OpenOffice documents from templates written in OpenOffice 2.x</p>
<p>Just make sure that there is no OO tag in between your code (no change in formatting etc.). content.xml is a valid XML file, so you can do some preprocessing using xml.dom.minidom. I would also …</p>
Freely redistributable