sdbs-infra/sdbs_infra/dashboard/models.py

36 lines
1 KiB
Python
Raw Normal View History

2020-06-14 12:08:11 +02:00
from enum import Enum
from django.db import models
from ordered_model.models import OrderedModel
class ServiceStatus(Enum):
OK = 'ok'
DOWN = 'down'
UNKNOWN = 'unknown'
class Service(OrderedModel):
short_name = models.CharField(null=False, max_length=64)
image = models.ImageField(null=True, blank=True, upload_to='services')
description = models.TextField(null=True, blank=True)
2020-06-15 12:26:39 +02:00
port = models.IntegerField(null=True, blank=True, help_text="Used for checking status")
2020-06-14 12:08:11 +02:00
url = models.URLField()
def __str__(self):
2020-06-20 19:32:10 +02:00
return f"{self.short_name} ({self.url})"
class Link(OrderedModel):
short_name = models.CharField(null=False, max_length=64)
image = models.ImageField(null=True, blank=True, upload_to='links')
description = models.TextField(null=True, blank=True)
url = models.URLField()
def __str__(self):
return f"{self.short_name} ({self.url})"
2020-06-20 19:52:36 +02:00
class Meta(OrderedModel.Meta):
2020-06-20 19:32:10 +02:00
verbose_name = "Important Link"
verbose_name_plural = "Important Links"