本文整理汇总了Python中utils.helper.SerializerHelper.delete_caches方法的典型用法代码示例。如果您正苦于以下问题:Python SerializerHelper.delete_caches方法的具体用法?Python SerializerHelper.delete_caches怎么用?Python SerializerHelper.delete_caches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utils.helper.SerializerHelper
的用法示例。
在下文中一共展示了SerializerHelper.delete_caches方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invalidate_caches_study
# 需要导入模块: from utils.helper import SerializerHelper [as 别名]
# 或者: from utils.helper.SerializerHelper import delete_caches [as 别名]
def invalidate_caches_study(sender, instance, **kwargs):
Model = None
filters = {}
if instance.study_type == 0:
Model = get_model("animal", "Endpoint")
filters["animal_group__experiment__study"] = instance.id
elif instance.study_type == 1:
Model = get_model("epi", "AssessedOutcome")
filters["exposure__study_population__study"] = instance.id
elif instance.study_type == 4:
Model = get_model("epi", "MetaResult")
filters["protocol__study"] = instance.id
Study.delete_caches([instance.id])
if Model:
ids = Model.objects.filter(**filters).values_list("id", flat=True)
SerializerHelper.delete_caches(Model, ids)
示例2: invalidate_caches_study
# 需要导入模块: from utils.helper import SerializerHelper [as 别名]
# 或者: from utils.helper.SerializerHelper import delete_caches [as 别名]
def invalidate_caches_study(sender, instance, **kwargs):
Model = None
filters = {}
if instance.study_type == 0:
Model = apps.get_model('animal', 'Endpoint')
filters["animal_group__experiment__study"] = instance.id
elif instance.study_type == 1:
Model = apps.get_model('epi', 'Outcome')
filters["study_population__study"] = instance.id
elif instance.study_type == 2:
Model = apps.get_model('invitro', 'ivendpoint')
filters["experiment__study_id"] = instance.id
elif instance.study_type == 4:
Model = apps.get_model('epimeta', 'MetaResult')
filters["protocol__study"] = instance.id
models.Study.delete_caches([instance.id])
if Model:
ids = Model.objects\
.filter(**filters)\
.values_list('id', flat=True)
SerializerHelper.delete_caches(Model, ids)
示例3: delete_caches
# 需要导入模块: from utils.helper import SerializerHelper [as 别名]
# 或者: from utils.helper.SerializerHelper import delete_caches [as 别名]
def delete_caches(cls, ids):
SerializerHelper.delete_caches(cls, ids)
示例4: clear_cache
# 需要导入模块: from utils.helper import SerializerHelper [as 别名]
# 或者: from utils.helper.SerializerHelper import delete_caches [as 别名]
def clear_cache(Model, filters):
ids = Model.objects\
.filter(**filters)\
.values_list('id', flat=True)
SerializerHelper.delete_caches(Model, ids)