You are here: Home / LBN / Up2date / Core Linux / BastionLinux 36 / python3-django-lifecycle-1.2.3-1.lbn36.noarch

python3-django-lifecycle-1.2.3-1.lbn36.noarch

Package Attributes
RPM  python3-django-lifecycle-1.2.3-1.lbn36.noarch.rpm Architecture  noarch Size  65529 Created  2024/04/02 10:53:34 UTC
Package Specification
Summary Declarative model lifecycle hooks.
Group Application/Internet
License ZPL
Home Page https://pypi.org/project/django-lifecycle
Description

Django Lifecycle Hooks

This project provides a @hook decorator as well as a base model and mixin to add lifecycle hooks to your Django models. Django's built-in approach to offering lifecycle hooks is Signals. However, my team often finds that Signals introduce unnecessary indirection and are at odds with Django's "fat models" approach. Django Lifecycle Hooks supports Python 3.5, 3.6, 3.7, 3.8 and 3.9, Django 2.0.x, 2.1.x, 2.2.x, 3.0.x and 3.1.x. In short, you can write model code like this: from django_lifecycle import LifecycleModel, hook, BEFORE_UPDATE, AFTER_UPDATE

class Article(LifecycleModel): contents = models.TextField() updated_at = models.DateTimeField(null=True) status = models.ChoiceField(choices=[draft, 'published']) editor = models.ForeignKey(AuthUser)

@hook(BEFORE_UPDATE, when=contents, has_changed=True) def on_content_change(self): self.updated_at = timezone.now()

@hook(AFTER_UPDATE, when="status", was="draft", is_now="pub

Requires
rpmlib(PayloadFilesHavePrefix)  
rpmlib(PayloadIsZstd)  
rpmlib(CompressedFileNames)  
rpmlib(PartialHardlinkSets)  
rpmlib(FileDigests)  
Provides
python-django-lifecycle
python3-django-lifecycle
python3.10-django-lifecycle
python3.10dist(django-lifecycle)
python3dist(django-lifecycle)
Obsoletes
python-django-lifecycle

Document Actions