Skip to main content

# flask-softdeletes

## 介绍 flask-softdeletes 基于flask-sqlalchemy的软删除实现

## 使用简介

### 1.安装 <code>pip install flask-softdeletes</code>

### 2.导入 SoftDeletedMixin

<code>from flask_softdeletes import SoftDeletedMixin</code>

### 3.模型类继承 SoftDeletedMixin

<code>class DemoModel(SoftDeletedMixin, db.Model):pass</code>

### 4.使用查询

[查询正常的数据,不包含已被软删除数据] <code> DemoModel.query</code>

[只查询已经被软删除的数据] <code> DemoModel.query.only_trashed</code>

[查询所有的数据, 包括已被软删除的和没有被软删除的数据] <code> DemoModel.query.with_trashed</code>

[软删除数据]

<code> demo = DemoModel.query.get(1)</code>

<code> demo.delete() </code>

[恢复软删除的数据]

<code> demo = DemoModel.query.with_trashed.get(1)</code>

<code> demo.restore() </code>

Metadata

Release files for Flask-SoftDeletes 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Flask-SoftDeletes 1.0.2
File Size Uploaded
Flask-SoftDeletes-1.0.2.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Flask-SoftDeletes 1.0.2
File Interpreter ABI Platform
Flask_SoftDeletes-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.6 kB

Release files / Flask-SoftDeletes-1.0.2.tar.gz

Download URL Flask-SoftDeletes-1.0.2.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4d31b25ba20791c6b31df34db1afee15d3a092ffb1bde29035be9721ab82d05a
BLAKE2b-256 checksum
How to use checksums
f98c126aebc2212ba25adffb7dc6d8d73633e2238d7a1a6acfad2aee6bbc9522
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Release files / Flask_SoftDeletes-1.0.2-py3-none-any.whl

Download URL Flask_SoftDeletes-1.0.2-py3-none-any.whl
Size 3.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
177ed8e856f7c874fb4d0720941ef09a68b83930d8c7aec933688981a3aa46c3
BLAKE2b-256 checksum
How to use checksums
f73820540d6eb68574cbde797b607ef0f4c6e4cf0479b518245c935840352eba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.9

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

1 release file

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page