djangosnippets.org: Latest snippets posted by davidwtbuxtonhttps://djangosnippets.org/users/davidwtbuxton/2011-02-17T10:02:00.611304-06:00davidwtbuxtonGroup sequence into rows and columns for a TABLE
2011-02-17T10:02:00.611304-06:00davidwtbuxtonhttps://djangosnippets.org/snippets/2361/<p>Two template tag filters that can be used to create a table from a sequence.
</p>
<pre><code><table>
{% for row in object_list|groupby_columns:3 %}
<tr>
{% for obj in row %}
<td>{{ obj }}</td>
{% endfor %}
</tr>
{% endfor %}
</table>
</code></pre><p>The example above would create a table where items read …</p>
Freely redistributableAutomate unique slug (again)
2008-05-17T13:35:58.913433-05:00davidwtbuxtonhttps://djangosnippets.org/snippets/761/<p>This takes the "easier to ask forgiveness than permission" approach to making sure your model's slug is unique.</p>
<p>If the model's slug is empty, make a slug from the model's 'name' field.</p>
<p>We assume that it is a conflicting slug that is throwing the IntegrityError, in which case if the …</p>
Freely redistributable