djangosnippets.org: Latest snippets tagged with 'introspection'https://djangosnippets.org/tags/introspection/2011-08-25T22:33:05.340951-05:00Auto-documenting Django Models with Sphinx
2011-08-25T22:33:05.340951-05:00Voightkampffhttps://djangosnippets.org/snippets/2533/<p>In my sphinx documentation I really wanted a nice clean list of the fields on my Django models. The most obvious way of doing this is to add ":param blah:" tags to the docstring, but this takes a long time to implement and violates DRY principles when you already have …</p>
Freely redistributableManager introspecting attached model
2008-02-25T16:46:26.308897-06:00ubernostrumhttps://djangosnippets.org/snippets/616/<p><a href="http://www.b-list.org/weblog/2008/feb/25/managers/#c63422">A comment on a recent blog entry of mine</a> asked about a setup where one model has foreign keys pointing at it from several others, and how to write a manager which could attach to any of those models and query seamlessly on the relation regardless of what it's named. …</p>
Freely redistributableInspect object debugging tag
2007-07-09T16:52:49.976930-05:00dballanchttps://djangosnippets.org/snippets/306/<p>Simple template tag that allows you to inspect an object in the context for debugging. It will inspect django models and forms using introspection. Dicts and lists are formatted to truncate long data. Pretty much everything else just displays the <strong>str</strong> representation + class name.</p>
<p>Example output: http://dsanity.net/introspectiontag.html</p>
<p>Usage:</p>
<p>put …</p>
Freely redistributable