1
0
Fork 0
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:
retspen 2018-09-23 13:17:48 +03:00
parent 5c2232f4e8
commit 6c2925a35d
478 changed files with 21437 additions and 134206 deletions

View file

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

5
backend/instance/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class InstanceConfig(AppConfig):
name = 'instance'

View file

107
backend/instance/models.py Normal file
View file

@ -0,0 +1,107 @@
from django.db import models
from django.conf import settings
from region.models import Region
from compute.models import Compute
from flavor.models import Size, Image
class Instance(models.Model):
ACTIVE = 1
INACTIVE = 0
STATUS_CHOICES = (
(ACTIVE, 'active'),
(INACTIVE, 'inactive'),
)
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
)
name = models.CharField(
max_length=255,
)
status = models.IntegerField(
choices=STATUS_CHOICES,
default=INACTIVE,
)
uuid = models.CharField(
max_length=40,
blank=True,
null=True,
)
compute = models.ForeignKey(
Compute,
blank=True,
null=True,
)
size = models.ForeignKey(
Size,
)
image = models.ForeignKey(
Image,
on_delete=models.CASCADE,
)
region = models.ForeignKey(
Region,
on_delete=models.CASCADE,
)
disk_bytes = models.BigIntegerField(
default=21474836480,
)
created_at = models.DateTimeField(
auto_now_add=True,
)
deleted_at = models.DateTimeField(
blank=True,
null=True,
)
is_task = models.BooleanField(
default=True,
)
task_id = models.IntegerField(
default=1,
)
is_private_network = models.BooleanField(
default=False,
)
is_locked = models.BooleanField(
default=False,
)
is_deleted = models.BooleanField(
default=False,
)
public_net_mac = models.CharField(
max_length=18,
default="52:54:00:01:02:03",
)
private_net_mac = models.CharField(
max_length=18,
blank=True,
null=True,
)
class Meta:
ordering = ['-id']
verbose_name = "Instance"
verbose_name_plural = "Instances"
def __unicode__(self):
return str(self.name)

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.