add a customer property to the Warranty and Backup model

This commit is contained in:
Andreas Zweili 2019-12-01 22:51:54 +01:00
parent 9b8af679ed
commit 463e25010b
2 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,10 @@ class Backup(models.Model):
def __str__(self):
return str(self.name)
@property
def customer(self):
return self.computer.customer
class TargetDevice(models.Model):
device = models.ForeignKey(Computer, models.SET_NULL, blank=True,

View File

@ -23,3 +23,7 @@ class Warranty(models.Model):
class Meta:
verbose_name_plural = "Warranties"
@property
def customer(self):
return self.device.customer