registered VM types model in the admin
This commit is contained in:
parent
368cfcecd1
commit
3015399692
5 changed files with 49 additions and 5 deletions
|
@ -1,4 +1,6 @@
|
|||
from django.contrib import admin
|
||||
from .models import RailsBetaUser, VirtualMachineType
|
||||
|
||||
admin.site.register(RailsBetaUser, VirtualMachineType)
|
||||
|
||||
admin.site.register(RailsBetaUser)
|
||||
admin.site.register(VirtualMachineType)
|
||||
|
|
|
@ -51,4 +51,5 @@ class Command(BaseCommand):
|
|||
def handle(self, *args, **options):
|
||||
|
||||
data = self.get_data()
|
||||
[VirtualMachineType.objects.create(**data[key]) for key in data.keys()]
|
||||
[VirtualMachineType.objects.create(hosting_company=key, **data[key])
|
||||
for key in data.keys()]
|
||||
|
|
20
hosting/migrations/0006_auto_20160418_0103.py
Normal file
20
hosting/migrations/0006_auto_20160418_0103.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2016-04-18 01:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hosting', '0005_auto_20160418_0038'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='virtualmachinetype',
|
||||
name='hosting_company',
|
||||
field=models.CharField(choices=[('hetzner_nug', 'Hetzner No Uptime Guarantee'), ('hetzner', 'Hetzner'), ('hetzner_raid6', 'Hetzner Raid6'), ('hetzner_glusterfs', 'Hetzner Glusterfs'), ('bern', 'Bern')], max_length=15),
|
||||
),
|
||||
]
|
20
hosting/migrations/0007_auto_20160418_0103.py
Normal file
20
hosting/migrations/0007_auto_20160418_0103.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.9.4 on 2016-04-18 01:03
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hosting', '0006_auto_20160418_0103'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='virtualmachinetype',
|
||||
name='hosting_company',
|
||||
field=models.CharField(choices=[('hetzner_nug', 'Hetzner No Uptime Guarantee'), ('hetzner', 'Hetzner'), ('hetzner_raid6', 'Hetzner Raid6'), ('hetzner_glusterfs', 'Hetzner Glusterfs'), ('bern', 'Bern')], max_length=30),
|
||||
),
|
||||
]
|
|
@ -3,8 +3,6 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from django.core import serializers
|
||||
|
||||
|
||||
|
||||
|
||||
class RailsBetaUser(models.Model):
|
||||
email = models.EmailField(unique=True)
|
||||
received_date = models.DateTimeField('date received')
|
||||
|
@ -34,7 +32,10 @@ class VirtualMachineType(models.Model):
|
|||
memory_price = models.FloatField()
|
||||
core_price = models.FloatField()
|
||||
disk_size_price = models.FloatField()
|
||||
hosting_company = models.CharField(max_length=10, choices=HOSTING_TYPES)
|
||||
hosting_company = models.CharField(max_length=30, choices=HOSTING_TYPES)
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.get_hosting_company_display())
|
||||
|
||||
def get_serialized_data(self):
|
||||
return serializers("json", self)
|
||||
|
|
Loading…
Reference in a new issue