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
0
backend/compute/__init__.py
Normal file
0
backend/compute/__init__.py
Normal file
3
backend/compute/admin.py
Normal file
3
backend/compute/admin.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
backend/compute/apps.py
Normal file
5
backend/compute/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class ComputeConfig(AppConfig):
|
||||
name = 'compute'
|
||||
39
backend/compute/migrations/0001_initial.py
Normal file
39
backend/compute/migrations/0001_initial.py
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Generated by Django 2.0.8 on 2018-09-22 07:20
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('region', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Compute',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=200, validators=[django.core.validators.RegexValidator('^[a-zA-Z0-9.-_]+$')])),
|
||||
('description', models.CharField(blank=True, max_length=255)),
|
||||
('address', models.CharField(max_length=50, validators=[django.core.validators.RegexValidator('^[a-zA-Z0-9._-]+$')], verbose_name='FQDN or IP Address')),
|
||||
('login', models.CharField(blank=True, max_length=20)),
|
||||
('password', models.CharField(blank=True, max_length=20)),
|
||||
('conn', models.IntegerField(choices=[(1, 'TCP'), (3, 'TLS'), (2, 'SSH'), (4, 'SOCKET')], default=1)),
|
||||
('is_active', models.BooleanField(default=False, verbose_name='Active')),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
('is_deleted', models.BooleanField(default=False, verbose_name='Deleted')),
|
||||
('deleted_at', models.DateTimeField(blank=True, null=True)),
|
||||
('region', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='region.Region')),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Compute',
|
||||
'verbose_name_plural': 'Computes',
|
||||
'ordering': ['-id'],
|
||||
},
|
||||
),
|
||||
]
|
||||
0
backend/compute/migrations/__init__.py
Normal file
0
backend/compute/migrations/__init__.py
Normal file
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
|
||||
3
backend/compute/tests.py
Normal file
3
backend/compute/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
backend/compute/views.py
Normal file
3
backend/compute/views.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
Loading…
Add table
Add a link
Reference in a new issue