Skip to main content

django-soft-remover

GitHub Actions PyPI PyPI - Python Version framework - Django PyPI - Django Version PyPI - License

Abstract Django models for soft removal.

It supports unique field indices specified with

  • unique
  • unique_together
  • UniqueConstraint (without expressions or conditions)

Just add the remver field to the composite unique index if you need to maintain uniqueness between removed versions.

Installation

$ pip install django-soft-remover

Example of use

from django.db import models

from soft_remover.models import SoftRemovableModel, SoftRestorableModel


class ManyUniqueTogetherRem(SoftRemovableModel):
    category = models.CharField(max_length=32)
    name = models.CharField(max_length=32)
    tag = models.CharField(max_length=32)
    value = models.PositiveSmallIntegerField()

    class Meta:
        unique_together = (('category', 'name', 'remver'), ('category', 'tag', 'remver'))

        
class UniqueWithConstraint(SoftRemovableModel):
    name = models.CharField(max_length=32)

    class Meta:
        constraints = [
            models.UniqueConstraint(fields=['name', 'remver'], name='uwc_name_remver'),
        ]

        
class ManyUniqueTogetherRes(SoftRestorableModel):
    category = models.CharField(max_length=32)
    name = models.CharField(max_length=32)
    tag = models.CharField(max_length=32)
    value = models.PositiveSmallIntegerField()

    class Meta:
        unique_together = (('category', 'name'), ('category', 'tag'))

See more examples in test models.

License

MIT

Metadata

Release files for django-soft-remover 0.5.0

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

Source distribution (sdist)

Source distribution for django-soft-remover 0.5.0
File Size Uploaded Provenance
django-soft-remover-0.5.0.tar.gz 5.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-soft-remover 0.5.0
File Interpreter ABI Platform
django_soft_remover-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.0 kB

Release files / django-soft-remover-0.5.0.tar.gz

Download URL django-soft-remover-0.5.0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e791fea488eff3b01c16350dcd3aa5dcaf5922941fcdc5961c8852b387581cab
BLAKE2b-256 checksum
How to use checksums
9585f036c801775998549c6afef79f3eb9b237cafe87c24e0eea75adac0d3d54
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Release files / django_soft_remover-0.5.0-py3-none-any.whl

Download URL django_soft_remover-0.5.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4db08c00e012bc88406a9f4b41d23282c129108986824cabc95cead5fabc0ad
BLAKE2b-256 checksum
How to use checksums
11699b3086ba33e2f843b13b111f475f4a493036eb9b5d3d2f0fe002e220fb0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.2

Security for django-soft-remover 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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