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.
This commit is contained in:
Lauryn Menard 2024-08-29 13:48:21 +02:00 committed by Tim Abbott
parent 333eedb351
commit e86c02cd67
1 changed files with 6 additions and 0 deletions

View File

@ -538,6 +538,12 @@ class LicenseLedger(models.Model):
# equal to the number of activated users in the organization. # equal to the number of activated users in the organization.
licenses_at_next_renewal = models.IntegerField(null=True) 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): class SponsoredPlanTypes(Enum):
# unspecified used for cloud sponsorship requests # unspecified used for cloud sponsorship requests