djangosnippets.org: Latest snippets tagged with 'duplicate'https://djangosnippets.org/tags/duplicate/2011-09-09T16:53:59.170999-05:00Duplicating Template Tag
2011-09-09T16:53:59.170999-05:00skarphacehttps://djangosnippets.org/snippets/2545/<p>This template tag will duplicate its contents according to a variable or integer supplied to it.</p>
<pre><code>{% duplicate 3 %}a{% endduplicate %}
</code></pre>
<p>This would return:</p>
<blockquote>
<p>aaa</p>
</blockquote>
Freely redistributableAuto-rename duplicate fields
2009-08-25T08:10:16.311591-05:00christian.oudardhttps://djangosnippets.org/snippets/1699/<p>This is useful to run before you add a unique key to a character field that has duplicates in it. It just adds numbers to the end of the contents, so they will be unique.</p>
<p>It takes a model class and a field name. The model class can be a …</p>
Freely redistributableDuplicate related objects of model instance
2009-01-13T17:58:05.411081-06:00johnboxallhttps://djangosnippets.org/snippets/1282/<p>I've got a bunch of <code>Models</code> that form a tree like structure. I'd like to duplicate them all changing one field to something else.
</p>
<p>Say for example I've got a <code>Website</code> which has <code>Pages</code> and <code>Links</code> and all kinds of other <code>Models</code>. Each one of these belong to a …</p>
Freely redistributable