Skip to main content

基于flask-sqlalchemy的软删除实现

Project description

# 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>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Flask-SoftDeletes-1.0.2.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

Flask_SoftDeletes-1.0.2-py3-none-any.whl (3.1 kB view details)

Uploaded Python 3

File details

Details for the file Flask-SoftDeletes-1.0.2.tar.gz.

File metadata

  • Download URL: Flask-SoftDeletes-1.0.2.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for Flask-SoftDeletes-1.0.2.tar.gz
Algorithm Hash digest
SHA256 4d31b25ba20791c6b31df34db1afee15d3a092ffb1bde29035be9721ab82d05a
MD5 549c0252d4c197e75dd925fd17f6c553
BLAKE2b-256 f98c126aebc2212ba25adffb7dc6d8d73633e2238d7a1a6acfad2aee6bbc9522

See more details on using hashes here.

File details

Details for the file Flask_SoftDeletes-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: Flask_SoftDeletes-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for Flask_SoftDeletes-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 177ed8e856f7c874fb4d0720941ef09a68b83930d8c7aec933688981a3aa46c3
MD5 83703705504e0c021fbabbf86fd5f798
BLAKE2b-256 f73820540d6eb68574cbde797b607ef0f4c6e4cf0479b518245c935840352eba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page