djangosnippets.org: Latest snippets tagged with 'dicts'https://djangosnippets.org/tags/dicts/2014-01-09T11:13:11.337566-06:00Dict Concat
2014-01-09T11:13:11.337566-06:00tomjleohttps://djangosnippets.org/snippets/3018/<p>Wanted a simple function to concatenate n dictionaries. Each dictionary passed in is deep copied to avoid any possible mutation of dictionaries being concatenated.</p>
<p>Dictionary m's key/values will be overwritten by dictionary m+1's key/values.</p>
Freely redistributableFieldsets for Views
2010-01-22T10:45:48.936419-06:00Nadhttps://djangosnippets.org/snippets/1883/<p>This Snippet allows a view to controle the printed forms on the templates, in a similar way to the fieldsets used by the django admin.</p>
<p>How to Use:</p>
<p>In the view in question, put:</p>
<pre><code>def some_view(request):
...
fieldsets = (
(u'Title 1',
{'hidden' : ('field_1', 'field_2',),
'fields' : ('field_3',)}),
(u'Title …</code></pre>
Freely redistributable