Пример #1
0
 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)
Пример #2
0
    def delete(self, instance):
        # 删除缓存
        BaseCache().delete_dimension_list()

        validated_data = {'status': instance.id + 1}
        return super(DimensionSerializer, self).update(instance,
                                                       validated_data)
Пример #3
0
    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)
Пример #4
0
 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)
Пример #5
0
    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)
Пример #6
0
 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)
Пример #7
0
 def delete(self, instance):
     BaseCache().delete_user_role_list()
     validated_data = {'status': instance.id + 1}
     return super(UserRoleSerializer, self).update(instance, validated_data)
Пример #8
0
 def save(self, **kwargs):
     BaseCache().delete_user_role_list()
     return super(UserRoleSerializer, self).save(**kwargs)
Пример #9
0
 def delete_data_from_cache(self, case_id):
     # 删除缓存
     BaseCache().delete_case_by_id(case_id)
     BaseCache().delete_case_search_dict()
Пример #10
0
 def delete_data_from_cache(self, information_id):
     # 删除缓存
     BaseCache().delete_information_by_id(information_id)
     BaseCache().delete_information_search_dict()
Пример #11
0
 def delete_data_from_cache(self, comment_id):
     # 删除缓存
     BaseCache().delete_comment_detail_by_comment_id(comment_id)
Пример #12
0
 def save(self, **kwargs):
     # 删除缓存
     BaseCache().delete_dimension_list()
     return super(DimensionSerializer, self).save(**kwargs)
Пример #13
0
    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)
Пример #14
0
    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)
Пример #15
0
 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)