sdbs-infra/sdbs_infra/dashboard/models.py

23 lines
644 B
Python
Raw Normal View History

2020-06-15 12:26:39 +02:00
import socket
2020-06-14 12:08:11 +02:00
from enum import Enum
from bs4 import BeautifulSoup
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):
return f"{self.short_name} ({self.url})"