Convenient soft-deletion support for Django models
Project description
django-livefield
About
A Django field that enables convenient soft-deletion. For Python 2.7/3.3+ and Django 1.8+
Installation
Simple: pip install django-livefield.
Example Usage
>>> from django.db import models
>>> from livefield import LiveField, LiveManager
>>>
>>>
>>> class Person(models.Model):
... name = models.CharField()
... live = LiveField()
...
... objects = LiveManager()
... all_objects = LiveManager(include_soft_deleted=True)
...
... class Meta:
... unique_together = ('name', 'live')
...
... def delete(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
MIT. See LICENSE.txt for details.
Contributing
Pull requests welcome! To save everyone some hassle, please open an issue first so we can discuss your proposed change.
In your PR, be sure to add your name to AUTHORS.txt and include some tests for your spiffy new functionality. CI will green-light your build once it passes the unit tests (./setup.py test) and our linters (./lint.sh).
Changelog
4.1.0
Add support for Python 3.12
Add support for Django 5.0
4.0.0
Add support for Python 3.8 - 3.11
Add support for Django 4.1 and 4.2
Remove support for old Django versions
Remove support for old Python versions
3.3.0
Django 3.x support
switch to BooleanField as base (Django 4.x deprecation)
3.2.1
Fix rST formatting in this file to pass PyPI rendering check
3.2.0 (Not released)
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 (Not released)
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 livefield.
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.
Developed and maintained by Hearsay Social, Inc..
Contributors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django-livefield-4.1.0.tar.gz
.
File metadata
- Download URL: django-livefield-4.1.0.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4d957e832d434f0092d929b40a95658ce31a0c5bfeb4c85fb365003d82da5b9 |
|
MD5 | f1bc2f890822c88642ec330b607ff63b |
|
BLAKE2b-256 | 8c24b01ed09a0aec0f83d11fea2725fd16750dd5f186312654632b3eaf0e9985 |
File details
Details for the file django_livefield-4.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: django_livefield-4.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.17
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fd3887ce98b137fd6a1ac2cb4b8217fb4ee5de9b14c0f34de4b251865f07b3a |
|
MD5 | 24cd1e6a4ddb06714341c6caeb5534d5 |
|
BLAKE2b-256 | a1c3db6d3a54a0480b392ef1d5e5a140195c4890d0b4d9b819d497565c4bfa10 |