From e86c02cd6734da700c3e8049d4b06d7a2af49cb1 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Thu, 29 Aug 2024 13:48:21 +0200 Subject: [PATCH] corporate: Revise string method for LicenseLedger objects. Includes the license counts, date and renewal information as well as the id field, so that print debugging and displaying these objects is easier and more useful. --- corporate/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/corporate/models.py b/corporate/models.py index 6690e6d8cf..f8f3fbc338 100644 --- a/corporate/models.py +++ b/corporate/models.py @@ -538,6 +538,12 @@ class LicenseLedger(models.Model): # equal to the number of activated users in the organization. licenses_at_next_renewal = models.IntegerField(null=True) + @override + def __str__(self) -> str: + ledger_type = "renewal" if self.is_renewal else "update" + ledger_time = self.event_time.strftime("%Y-%m-%d %H:%M") + return f"License {ledger_type}, {self.licenses} purchased, {self.licenses_at_next_renewal} next cycle, {ledger_time} (id={self.id})" + class SponsoredPlanTypes(Enum): # unspecified used for cloud sponsorship requests