From dfc32e28103d652170868d09b49ba98ea95c91bf Mon Sep 17 00:00:00 2001 From: Chris Lovering Date: Wed, 27 Jul 2022 21:33:13 +0100 Subject: Add a field to track the time an infraction was last applied A default is set for backwards compatibility with bot version that don't explicitly give a value. --- pydis_site/apps/api/models/bot/infraction.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'pydis_site/apps/api/models/bot') diff --git a/pydis_site/apps/api/models/bot/infraction.py b/pydis_site/apps/api/models/bot/infraction.py index c9303024..218ee5ec 100644 --- a/pydis_site/apps/api/models/bot/infraction.py +++ b/pydis_site/apps/api/models/bot/infraction.py @@ -23,6 +23,12 @@ class Infraction(ModelReprMixin, models.Model): default=timezone.now, help_text="The date and time of the creation of this infraction." ) + last_applied = models.DateTimeField( + # This default is for backwards compatibility with bot versions + # that don't explicitly give a value. + default=timezone.now, + help_text="The date and time of when this infraction was last applied." + ) expires_at = models.DateTimeField( null=True, help_text=( -- cgit v1.2.3