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) port = models.IntegerField(null=True, blank=True, help_text="Used for checking status") url = models.URLField() def __str__(self): 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})" class Meta: verbose_name = "Important Link" verbose_name_plural = "Important Links"