djangosnippets.org: Latest snippets tagged with 'display'https://djangosnippets.org/tags/display/2009-09-27T06:13:10-05:00Render arbitrary models - template tag2009-09-27T06:13:10-05:00jeffschenckhttps://djangosnippets.org/snippets/1745/<p>This template tag provides an easy way to render objects in your template, even if you don't know ahead of time what type they are.
</p>
<p>For example, if you've got a search page with a result list comprised of objects from various models, you can simply loop through ...</p>
Freely redistributableShowOnly widget for froms2008-11-13T09:19:40-06:00alexmeiselhttps://djangosnippets.org/snippets/1185/<p>This form widget allows you to just display data in a rendered form, not giving the user the opportunity to change it. The initial data will just be carried through the form and showed to the user.</p>
<p>In combination with snipped <a href="http://www.djangosnippets.org/snippets/1184/">1184</a> you can make this even tamper safe. ;-)</p>
Freely redistributableDisplay arbitrary models2008-07-17T03:37:15-05:00bjornkrihttps://djangosnippets.org/snippets/890/<p>Template tag for displaying a list of arbitrary models. Useful for life-stream kind of pages that display blog entries, links, photos etc ordered by date. <a href="http://bjornkri.com">Example</a></p>
<p><strong>Usage:</strong> something like:</p>
<pre><code>{% for object in object_list %}
{% display_excerpt object %}
{% endfor %}
</code></pre>
<p>Will look for <em>app/model_excerpt.html</em> by default, and fall back on a generic ...</p>
Freely redistributableClass ModelInfo for show object info2008-07-01T15:36:48-05:00marinhohttps://djangosnippets.org/snippets/843/<p>This class works in compatibility with a ModelForm, but instead of show a form, it shows the field values.</p>
<p>The Meta class attributes can be used to customize fields to show, to be excluded, to divide by sections, to urlize text fields, etc.</p>
<p><strong>Example 1:</strong></p>
<pre><code>class InfoSingleCertificate(ModelInfo):
class Meta ...</code></pre>
Freely redistributableTemplate tag for returning &#39;Morning&#39;, &#39;Afternoon&#39; and &#39;Evening&#39; in the local timezone2007-04-17T01:27:20-05:00obeattiehttps://djangosnippets.org/snippets/185/<p>Returns 'Morning', 'Afternoon', or 'Evening' in the local timezone (specified in settings). Required pytz. 0000-1200 considered morning, 1200-1800 considered afternoon, 1800-0000 considered evening.</p>
Freely redistributable