Задать вопрос

Тел: +7 965 3737 888

503

Просмотров

1

Ответов

Dump a model instance and related objects as a Python data structure

<p>This utility makes a text dump of a model instance, including objects related by a forward or reverse foreign key. The result is a hierarchical data structure where</p>
<ul><li>
<p>each instance is represented as a list of fields,</p>
</li>
<li>
<p>each field as a (&lt;name&gt;, &lt;value&gt;) tuple,</p>
</li>
<li>
<p>each &lt;value&gt; as a primitive type, a related object (as a list of fields), or a list of related objects.</p>
</li>
</ul><p>See the docstring for examples.</p>
<p>We used this to make text dumps of parts of the database before and after running a batch job. The format was more useful than stock dumpdata output since all related data is included with each object. These dumps lend themselves particularly well for comparison with a visual diff tool like <a href="http://meldmerge.org/">Meld</a>.</p>

Вопрос полезен? Да0/Нет0
file_3130.py(4.4Кб)
None

Ответы (1):

Ответckarrie2:31.01.2012
Ответ полезен? Да0/Нет0

Interesting. Is there a way to "load" the data back?