Skip to main content

Convenient soft-deletion support for Django models

Project description

django-livefield

Build Status

About

A Django field that enables convenient soft-deletion.

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. Travis CI will green-light your build once it passes the unit tests (./setup.py test) and our linters (./lint.sh).

Changelog

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


Download files

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

Source Distribution

django-livefield-2.2.0.tar.gz (5.8 kB view details)

Uploaded Source

File details

Details for the file django-livefield-2.2.0.tar.gz.

File metadata

File hashes

Hashes for django-livefield-2.2.0.tar.gz
Algorithm Hash digest
SHA256 f36a85dd9ad9ba708314e9f8cce6b15fb8a3185cdf4c009b9ac51643f6b27a85
MD5 d127daf28b2e1c858385e10c75be4f70
BLAKE2b-256 5987069424352dca573eab20fd0ec862698faf27f292fa60b7c443be11e21a6f

See more details on using hashes here.

Supported by

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