network_inventory/network_inventory/inventory/models/warranty.py

26 lines
678 B
Python
Raw Normal View History

2019-06-10 21:56:21 +02:00
from django.db import models
from .devices import Device
from .category import Category
class WarrantyType(Category):
description = models.TextField()
class Meta:
verbose_name_plural = "Warranty Types"
class Warranty(models.Model):
device = models.ForeignKey(Device, on_delete=models.CASCADE)
valid_from = models.DateField()
valid_until = models.DateField()
duration_in_years = models.IntegerField()
2019-07-19 16:32:24 +02:00
warranty_type = models.ForeignKey(WarrantyType, models.SET_NULL,
blank=True, null=True)
2019-06-10 21:56:21 +02:00
def __str__(self):
return self.device
class Meta:
verbose_name_plural = "Warranties"