本文整理汇总了Python中django.db.models.query.CollectedObjects.unordered_keys方法的典型用法代码示例。如果您正苦于以下问题:Python CollectedObjects.unordered_keys方法的具体用法?Python CollectedObjects.unordered_keys怎么用?Python CollectedObjects.unordered_keys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类django.db.models.query.CollectedObjects
的用法示例。
在下文中一共展示了CollectedObjects.unordered_keys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _publisher_delete_marked
# 需要导入模块: from django.db.models.query import CollectedObjects [as 别名]
# 或者: from django.db.models.query.CollectedObjects import unordered_keys [as 别名]
def _publisher_delete_marked(self, collect=True):
"""If this instance, or some remote instances are marked for deletion
kill them.
"""
if self.publisher_is_draft:
# escape soon from draft models
return
if collect:
from django.db.models.query import CollectedObjects
seen = CollectedObjects()
self._collect_delete_marked_sub_objects(seen)
for cls in seen.unordered_keys():
items = seen[cls]
if issubclass(cls, Page):
for item in items.values():
item._publisher_delete_marked(collect=False)
if self.publisher_state == self.PUBLISHER_STATE_DELETE:
try:
self.delete()
except AttributeError:
# this exception may happen because of the plugin relations
# to CMSPlugin and mppt way of _meta assignment
pass