From 3e7847e6452c254346bf1c48649d36b113b6263f Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Sat, 11 Sep 2021 09:00:52 -0700 Subject: [PATCH] Set deactivation date --- bookwyrm/models/user.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bookwyrm/models/user.py b/bookwyrm/models/user.py index e6bd453fb..1b03f93af 100644 --- a/bookwyrm/models/user.py +++ b/bookwyrm/models/user.py @@ -270,6 +270,11 @@ class User(OrderedCollectionPageMixin, AbstractUser): # this user already exists, no need to populate fields if not created: + if self.is_active: + self.deactivation_date = None + elif not self.deactivation_date: + self.deactivation_date = timezone.now() + super().save(*args, **kwargs) return