djangosnippets.org: Latest snippets posted by Rozzahttps://djangosnippets.org/users/Rozza/2008-07-11T10:49:17.248704-05:00Rozzaupload handler decorators
2008-07-11T10:49:17.248704-05:00Rozzahttps://djangosnippets.org/snippets/875/<p>In an admin custom view I had the requirement to modify the upload handlers.</p>
<p>However, the @staff_member_required locked the Files upload handlers as it uses the request.POST - see <a href="http://code.djangoproject.com/ticket/7654">Ticket 7654</a>.</p>
<p>These decorators can be used before other decorators to allow setting of the upload handlers.</p>
<p>Usage example:</p>
<pre><code>@upload_handlers_insert(0, …</code></pre>
Freely redistributablecreate_update for newforms (ModelForm)
2008-03-10T08:57:38.244779-05:00Rozzahttps://djangosnippets.org/snippets/635/<p>Based on <a href="http://www.djangosnippets.org/users/danjak/">danjak's</a> <a href="http://www.djangosnippets.org/snippets/99/">snippet</a> but updated to use ModelForms - so can easily handle generic CRUD operations. </p>
<p>A replacement create_update.py for use with ModelForm</p>
<p>create_object and update_project modified to handle newforms (including FileFields) with ModelForm - it also had delete_object as well for completeness.</p>
<p>In addition, it has some extras: …</p>
Freely redistributable