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. [Example](http://bjornkri.com)
**Usage:** something like:
{% for object in object_list %}
{% display_excerpt object %}
{% endfor %}
Will look for *app/model_excerpt.html* by default, and fall back on a generic *display_excerpt.html*, or returns the object's string representation as a last fallback.
*display_excerpt.html* might look something like:
<a href="{{ object.get_absolute_url }}">{{ object }}</a>
Any model you throw at it should have a *get_absolute_url* and a string representation of some sort, so this gives you the bare minimum of a title and a link to a detail page.
*display_excerpt* takes an optional argument to set the template suffix. This might be handy for generating different formatting for feeds, for instance:
{% for object in object_list %}
{% display_excerpt object "feed" %}
{% endfor %}
This will look for app/model_feed.html to render the object.
Got lots of help from mattmcc on #django for this one, thanks!
- display
- excerpt
- lifestream
Warning: This python script is designed for Django 0.96.
It exports data from models quite like the `dumpdata` command, and throws the
data to the standard output.
It fixes glitches with unicode/ascii characters. It looked like the 0.96
handles very badly unicode characters, unless you specify an argument that is
not available via the command line. The simple usage is:
$ python export_models.py -a <application1> [application2, application3...]
As a plus, it allows you to export only one or several models inside your
application, and not all of them:
$ python export_models.py application1.MyModelStuff application1.MyOtherModel
Of course, you can specify the output format (serializer) with the -f
(--format) option.
$ python export_models.py --format=xml application1.MyModel
- tool
- dump
- serialization
- export
- db
- database