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

Тел: +7 965 3737 888

443

Просмотров

0

Ответов

Queryset Foreach

<p>Call a function for each element in a queryset (actually, any list).</p>
<p>Features:</p>
<ul><li>stable memory usage (thanks to Django paginators)</li>
<li>progress indicators</li>
<li>wraps batches in transactions</li>
<li>can take managers or even models (e.g., Assertion.objects)</li>
<li>warns about DEBUG.</li>
<li>handles failures of single items without dying in general.</li>
<li>stable even if items are added or removed during processing (gets a list of ids at the start)</li>
</ul><p>Returns a Status object, with the following interesting attributes</p>
<ul><li>total: number of items in the queryset</li>
<li>num_successful: count of successful items</li>
<li>failed_ids: list of ids of items that failed</li>
</ul>

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