def update(self, instance, validated_data): BaseCache().delete_user_role_list() pop_keys = ['user_role_id', 'pk', 'id'] for key in pop_keys: if key in validated_data: validated_data.pop(key) return super(UserRoleSerializer, self).update(instance, validated_data)
def delete(self, instance): # 删除缓存 BaseCache().delete_dimension_list() validated_data = {'status': instance.id + 1} return super(DimensionSerializer, self).update(instance, validated_data)
def update(self, instance, validated_data): # 删除缓存 BaseCache().delete_report_by_id(report_id=instance.id) pop_keys = ['pk', 'id'] for key in pop_keys: if key in validated_data: validated_data.pop(key) return super(ReportSerializer, self).update(instance, validated_data)
def update(self, instance, validated_data): # 删除缓存 BaseCache().delete_adjust_coefficient_by_name( adjust_coefficient_name=instance.name) pop_keys = ['pk', 'id', 'adjust_coefficient_id'] for key in pop_keys: if key in validated_data: validated_data.pop(key) return super(AdjustCoefficientSerializer, self).update(instance, validated_data)
def update(self, instance, validated_data): # 删除缓存 BaseCache().delete_dimension_list() pop_keys = ['dimension_id', 'pk', 'id'] for key in pop_keys: if key in validated_data: validated_data.pop(key) return super(DimensionSerializer, self).update(instance, validated_data)
def delete_from_cache(self, instance): # 从缓存中删除数据 BaseCache().delete_advert_list_by_source_type(instance.source_type) BaseCache().delete_advert_detail_by_advert_id(instance.id)
def delete(self, instance): BaseCache().delete_user_role_list() validated_data = {'status': instance.id + 1} return super(UserRoleSerializer, self).update(instance, validated_data)
def save(self, **kwargs): BaseCache().delete_user_role_list() return super(UserRoleSerializer, self).save(**kwargs)
def delete_data_from_cache(self, case_id): # 删除缓存 BaseCache().delete_case_by_id(case_id) BaseCache().delete_case_search_dict()
def delete_data_from_cache(self, information_id): # 删除缓存 BaseCache().delete_information_by_id(information_id) BaseCache().delete_information_search_dict()
def delete_data_from_cache(self, comment_id): # 删除缓存 BaseCache().delete_comment_detail_by_comment_id(comment_id)
def save(self, **kwargs): # 删除缓存 BaseCache().delete_dimension_list() return super(DimensionSerializer, self).save(**kwargs)
def delete(self, instance): # 删除缓存 BaseCache().delete_report_by_id(report_id=instance.id) validated_data = {'status': instance.id + 1} return super(ReportSerializer, self).update(instance, validated_data)
def delete(self, instance): # 删除缓存 BaseCache().delete_media_by_id(media_id=instance.id) validated_data = {'status': instance.id + 1} return super(MediaSerializer, self).update(instance, validated_data)
def delete_tag_list_from_cache(self): # 删除缓存 dimension_instances = Dimension.filter_objects() for ins in dimension_instances: BaseCache().delete_tag_list_by_dimension_id(dimension_id=ins.id)