TicketTag/Priority order field
This commit is contained in:
@ -19,6 +19,7 @@ class TicketPriority(models.Model):
|
||||
title = models.CharField(max_length=32)
|
||||
colour = models.CharField(max_length=7)
|
||||
backgroundcolour = models.CharField(max_length=7)
|
||||
order = models.PositiveIntegerField(default=0, blank=False, null=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
@ -30,6 +31,7 @@ class TicketTag(models.Model):
|
||||
title = models.CharField(max_length=32)
|
||||
colour = models.CharField(max_length=7)
|
||||
backgroundcolour = models.CharField(max_length=7)
|
||||
order = models.PositiveIntegerField(default=0, blank=False, null=False)
|
||||
|
||||
def __str__(self):
|
||||
return self.title
|
||||
@ -141,35 +143,7 @@ class Ticket(models.Model):
|
||||
return self.create_timestamp != self.edit_timestamp
|
||||
|
||||
@property
|
||||
def is_older_than_day(self) -> bool:
|
||||
"""Returns boolean dependent on if `self.timestamp` is older than 24 hours.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
True if `self.timestamp` is older than 24 hours, False otherwise.
|
||||
"""
|
||||
|
||||
dayago = timezone.now() - timedelta(hours=24)
|
||||
return self.timestamp <= dayago
|
||||
|
||||
@property
|
||||
def was_yesterday(self) -> bool:
|
||||
"""Returns a boolean dependent on if `self.timestamp` is from before midnight yesterday.
|
||||
|
||||
Returns
|
||||
-------
|
||||
bool
|
||||
_description_
|
||||
"""
|
||||
|
||||
now = timezone.now()
|
||||
midnight_today = now - timedelta(hours=now.hour, minutes=now.minute, seconds=now.second, microseconds=now.microsecond)
|
||||
|
||||
return self.timestamp < midnight_today
|
||||
|
||||
@property
|
||||
def string_datetime(self) -> str:
|
||||
def display_datetime(self) -> str:
|
||||
"""Provides a human readable string representation of `self.timestamp` that should be displayed
|
||||
to represent the ticket's age.
|
||||
|
||||
|
Reference in New Issue
Block a user