Improvment on Provider

Some model improvment on provider

Change-Id: Id55e7cd982494554b3391a43a1061e68072248d5
Signed-off-by: Paarhati Ozkasgarli <ozkasgarli@gmail.com>
This commit is contained in:
Paarhati Ozkasgarli 2016-12-04 14:11:25 +00:00 committed by Ferhat Ozkasgarli
parent cc0308df9c
commit 3da226dce3
7 changed files with 140 additions and 37 deletions

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-04 11:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('provider', '0003_type'),
]
operations = [
migrations.AlterField(
model_name='provider',
name='provider',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='provider.Type'),
),
]

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-04 12:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('provider', '0004_auto_20161204_1157'),
]
operations = [
migrations.AlterField(
model_name='provider',
name='region',
field=models.CharField(db_index=True, max_length=255),
),
migrations.AlterField(
model_name='provider',
name='username',
field=models.CharField(db_index=True, max_length=255),
),
]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-04 12:12
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('provider', '0005_auto_20161204_1208'),
]
operations = [
migrations.AlterField(
model_name='type',
name='name',
field=models.CharField(db_index=True, max_length=255),
),
]

View File

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-04 12:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('provider', '0006_auto_20161204_1212'),
]
operations = [
migrations.AlterField(
model_name='type',
name='name',
field=models.CharField(db_index=True, max_length=255, unique=True),
),
]

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-04 12:30
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('provider', '0007_auto_20161204_1217'),
]
operations = [
migrations.AlterField(
model_name='provider',
name='provider',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='provider.Type'),
),
]

View File

@ -2,42 +2,6 @@ from __future__ import unicode_literals
from django.db import models
class Provider(models.Model):
id = models.AutoField(primary_key=True)
provider = models.CharField(max_length=64)
name = models.CharField(
max_length=255,
unique=True,
db_index=True
)
region = models.CharField(
max_length=255,
unique=True,
db_index=True
)
project_id = models.CharField(
max_length=255,
db_index=True
)
default_role = models.CharField(max_length=255)
default_domain_id = models.CharField(max_length=255)
username = models.CharField(
max_length=255,
unique=True,
db_index=True
)
password = models.CharField(max_length=255)
api_version = models.CharField(max_length=255)
url = models.TextField()
created_at = models.DateField()
enabled = models.BooleanField(default=True)
validated = models.BooleanField(default=False)
def __unicode__(self):
return self.name
class Type(models.Model):
types = (
('1', 'Public Cloud Provider'),
@ -49,7 +13,7 @@ class Type(models.Model):
name = models.CharField(
max_length=255,
unique=True,
db_index=True
db_index=True,
)
type = models.CharField(
max_length=1,
@ -60,3 +24,35 @@ class Type(models.Model):
def __unicode__(self):
return self.name
class Provider(models.Model):
id = models.AutoField(primary_key=True)
provider = models.ForeignKey(Type)
name = models.CharField(
max_length=255,
unique=True,
db_index=True,
)
region = models.CharField(
max_length=255,
db_index=True,
)
project_id = models.CharField(
max_length=255,
db_index=True,
)
default_role = models.CharField(max_length=255)
default_domain_id = models.CharField(max_length=255)
username = models.CharField(
max_length=255,
db_index=True,
)
password = models.CharField(max_length=255)
api_version = models.CharField(max_length=255)
url = models.TextField()
created_at = models.DateField()
enabled = models.BooleanField(default=True)
validated = models.BooleanField(default=False)
def __unicode__(self):
return self.name

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB