Django模型的方便软删除支持
django-livefield的Python项目详细描述
关于
允许方便软删除的django字段。对于python 2.7/3.3+和django 1.8+
安装
简单:pip install django-livefield。
示例用法
>>>fromdjango.dbimportmodels>>>fromlivefieldimportLiveField,LiveManager>>>>>>>>>classPerson(models.Model):...name=models.CharField()...live=LiveField()......objects=LiveManager()...all_objects=LiveManager(include_soft_deleted=True)......classMeta:...unique_together=('name','live')......defdelete(self,using=None):...self.live=False...self.save(using=using)...>>>john=Person.objects.create(name='John Cleese')>>>doppelganger=Person(name='John Cleese')>>>doppelganger.save()# Raises an IntegrityError>>>john.delete()>>>doppelganger.save()# Succeeds!
许可证
麻省理工学院。有关详细信息,请参见license.txt。
贡献
拉请求欢迎!为了省去大家的麻烦,请打开一个 先发布,以便我们讨论您提出的更改。
在您的公关中,请确保将您的姓名添加到authors.txt中,并包括一些 测试你的新功能。特拉维斯·西会让你的 一旦通过单元测试(./setup.py test)和 绒布(./lint.sh)。
变更日志
3.2.1
- Fix rST formatting in this file to pass PyPI rendering check
3.2.0(未发布)
- Support Django 2.2
- Support Python 3.7
- Fix metadata to remove deprecated Django versions
- Expand travis tests for versions and database engines
- Remove obsolete pylint suppressions
- Thanks to [@shurph](https://github.com/shurph) for the above!
3.1.0
- Fix [deprecation of context param for Field.from_db_value](https://code.djangoproject.com/ticket/28370)
- Support for Django 2.1 (Thanks [@lukeburden](https://github.com/lukeburden)
- Switch tests suite to use pytest
- Remove pylint-django plugin, no longer needed
3.0.0
- Add support for Python 3.6
- Add support for Django 2.0
- Remove support for Python 3.4
- Remove support for old Django versions
- Remove GIS
2.5.0(未发布)
- Added official Python 3 support.
- Re-added support for Django 1.8. Now supports Django 1.8 and 1.9.
2.4.0(2016-02-11)
- Drop support for Django 1.8
- Add number of affected rows for delete methods (hard_delete, soft_delete, delete). Note: Django 1.9+ only.
2.1.0(2014-09-04)
- Add support for Django 1.7.
2.0.0(2014-07-13)
- Renamed top-level namespace to ^{tt4}$.
- Restructured internally to match Django convention.
- Added GIS support.
- Added South support.
1.0.0(2014-02-14)
- Initial release.
- Separated existing code from main application repository.
由Hearsay Social, Inc.开发和维护。