Commit 52f0cf7c by Gazdag Péter

Basic models created

parent ccda90c9
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class ImageConfig(AppConfig):
name = 'image'
from django.db import models
# Create your models here.
class Disk():
"""A virtual disk.
"""
name = CharField(blank=True, max_length=100, verbose_name=_("name"), help_text=_("Name of the disk"))
remote_ID = CharField(max_length=40, unique=True, verbose_name=_("remote_ID"), help_text=_("ID, which helps access the disk"))
\ No newline at end of file
from rest_framework import serializers
from .models import Disk
class DiskSerializer(serializers.ModelSerializer):
class Meta:
model = Disk
fields = ('name', 'remote_ID',)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
...@@ -34,6 +34,7 @@ ALLOWED_HOSTS = [ ...@@ -34,6 +34,7 @@ ALLOWED_HOSTS = [
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
'image.apps.ImageConfig',
'django.contrib.admin', 'django.contrib.admin',
'django.contrib.auth', 'django.contrib.auth',
'django.contrib.contenttypes', 'django.contrib.contenttypes',
......
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class StorageConfig(AppConfig):
name = 'storage'
from django.db import models
# Create your models here.
class DataStore():
"""Collection of virtual disks.
"""
name = CharField(max_length=100, unique=True, verbose_name=_('name'), help_text=_("Name of the data store."))
remote_ID = CharField(max_length=40, unique=True, verbose_name=_("remote_ID"), help_text=_("ID, which helps access the data store."))
#vm
\ No newline at end of file
from rest_framework import serializers
from .models import DataStore
class DataStoreSerializer(serializers.ModelSerializer):
class Meta:
model = DataStore
fields = ('name', 'remote_ID',)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
from django.contrib import admin
# Register your models here.
from django.apps import AppConfig
class TemplateConfig(AppConfig):
name = 'template'
from django.db import models
class InstanceTemplate():
"""Virtual machine template.
"""
name = CharField(max_length=100, verbose_name=_('name'),
help_text=_('Human readable name of template.'))
description = TextField(verbose_name=_('description'), blank=True, help_text=_("Description of the template."))
owner = ForeignKey(User)
remote_ID = CharField(max_length=40, unique=True, verbose_name=_("remote_ID"), help_text=_("ID, which helps access the template."))
\ No newline at end of file
from rest_framework import serializers
from .models import InstanceTemplate
class InstanceTemplateSerializer(serializers.ModelSerializer):
class Meta:
model = InstanceTemplate
fields = ('name', 'description', 'owner', 'remote_ID',)
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment