Semaine 11
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
from django.db import models
|
||||
from django.conf import settings
|
||||
|
||||
class Equipment(models.Model):
|
||||
hostname = models.CharField(max_length=200)
|
||||
ip = models.GenericIPAddressField()
|
||||
is_active = models.BooleanField(default=True)
|
||||
owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
||||
internal_notes = models.TextField(blank=True, default="")
|
||||
|
||||
def __str__(self):
|
||||
if self.is_active:
|
||||
return f"{self.hostname} - {self.ip}"
|
||||
else:
|
||||
return f"{self.hostname} is DOWN."
|
||||
Reference in New Issue
Block a user