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/instance/__init__.py
Normal file
0
backend/instance/__init__.py
Normal file
3
backend/instance/admin.py
Normal file
3
backend/instance/admin.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
5
backend/instance/apps.py
Normal file
5
backend/instance/apps.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class InstanceConfig(AppConfig):
|
||||
name = 'instance'
|
||||
0
backend/instance/migrations/__init__.py
Normal file
0
backend/instance/migrations/__init__.py
Normal file
107
backend/instance/models.py
Normal file
107
backend/instance/models.py
Normal 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)
|
||||
3
backend/instance/tests.py
Normal file
3
backend/instance/tests.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
3
backend/instance/views.py
Normal file
3
backend/instance/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