Add memo, should_bill fields to Usage table

This commit is contained in:
Tanner Collin 2022-02-03 23:37:26 +00:00
parent 1457714642
commit 2cbb872248
2 changed files with 5 additions and 2 deletions

View File

@ -172,10 +172,12 @@ class Usage(models.Model):
device = models.CharField(max_length=64)
start_time = models.DateTimeField(auto_now_add=True)
last_update = models.DateTimeField(auto_now=True)
updated_at = models.DateTimeField(auto_now=True)
num_seconds = models.IntegerField()
memo = models.TextField(blank=True)
should_bill = models.BooleanField(default=True)
history = HistoricalRecords(excluded_fields=['num_seconds'])
history = HistoricalRecords(excluded_fields=['num_seconds', 'updated_at'])
class HistoryIndex(models.Model):
content_type = models.ForeignKey(ContentType, null=True, on_delete=models.SET_NULL)

View File

@ -663,6 +663,7 @@ class StatsViewSet(viewsets.ViewSet, List):
username=username,
device=device,
num_seconds=0,
memo='',
)
logging.info('New %s session created for: %s', device, username or '[no username]')