mirror of
https://github.com/retspen/webvirtcloud
synced 2026-03-23 11:04:49 +00:00
Added V2 from scratch
This commit is contained in:
parent
5c2232f4e8
commit
6c2925a35d
478 changed files with 21437 additions and 134206 deletions
81
backend/compute/models.py
Normal file
81
backend/compute/models.py
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
from django.db import models
|
||||
from django.core.validators import RegexValidator
|
||||
from region.models import Region
|
||||
|
||||
|
||||
class Compute(models.Model):
|
||||
|
||||
TCP = 1
|
||||
TLS = 3
|
||||
SSH = 2
|
||||
SOCKET = 4
|
||||
|
||||
CONN_CHOICES = (
|
||||
(TCP, 'TCP'),
|
||||
(TLS, 'TLS'),
|
||||
(SSH, 'SSH'),
|
||||
(SOCKET, 'SOCKET'),
|
||||
)
|
||||
|
||||
name = models.CharField(
|
||||
max_length=200,
|
||||
validators=[RegexValidator('^[a-zA-Z0-9.-_]+$')],
|
||||
)
|
||||
|
||||
region = models.ForeignKey(
|
||||
Region,
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
description = models.CharField(
|
||||
max_length=255,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
address = models.CharField(
|
||||
'FQDN or IP Address',
|
||||
max_length=50,
|
||||
validators=[RegexValidator('^[a-zA-Z0-9._-]+$')],
|
||||
)
|
||||
|
||||
login = models.CharField(
|
||||
max_length=20,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
password = models.CharField(
|
||||
max_length=20,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
conn = models.IntegerField(
|
||||
choices=CONN_CHOICES,
|
||||
default=TCP,
|
||||
)
|
||||
|
||||
is_active = models.BooleanField(
|
||||
'Active',
|
||||
default=False,
|
||||
)
|
||||
|
||||
created_at = models.DateTimeField(
|
||||
auto_now_add=True,
|
||||
)
|
||||
|
||||
is_deleted = models.BooleanField(
|
||||
'Deleted',
|
||||
default=False,
|
||||
)
|
||||
|
||||
deleted_at = models.DateTimeField(
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ['-id']
|
||||
verbose_name = "Compute"
|
||||
verbose_name_plural = "Computes"
|
||||
|
||||
def __unicode__(self):
|
||||
return self.name
|
||||
Loading…
Add table
Add a link
Reference in a new issue