diff --git a/dash_stack_dashboard/_i18n.py b/dash_stack_dashboard/_i18n.py index 8a3fce9..9bb519a 100644 --- a/dash_stack_dashboard/_i18n.py +++ b/dash_stack_dashboard/_i18n.py @@ -12,7 +12,7 @@ _ = _translators.primary # The contextual translation function using the name "_C" # requires oslo.i18n >=2.1.0 _C = _translators.contextual_form - +ya # The plural translation function using the name "_P" # requires oslo.i18n >=2.1.0 _P = _translators.plural_form diff --git a/dash_stack_dashboard/settings.py b/dash_stack_dashboard/settings.py index b9a0fdc..a451bfe 100644 --- a/dash_stack_dashboard/settings.py +++ b/dash_stack_dashboard/settings.py @@ -55,6 +55,7 @@ INSTALLED_APPS = [ 'security', 'server', 'user_profile', + 'provider', ] MIDDLEWARE = [ diff --git a/provider/__init__.py b/provider/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/provider/admin.py b/provider/admin.py new file mode 100644 index 0000000..62c1171 --- /dev/null +++ b/provider/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin +from .models import Provider, Type + +class ProviderAdmin(admin.ModelAdmin): + model = Provider + list_display = ['id', 'name', 'provider', 'enabled', 'validated'] + +class TypeAdmin(admin.ModelAdmin): + model = Type + list_display = ['id', 'name', 'type', 'logo'] + +admin.site.register(Provider,ProviderAdmin) +admin.site.register(Type,TypeAdmin) \ No newline at end of file diff --git a/provider/apps.py b/provider/apps.py new file mode 100644 index 0000000..6b1606b --- /dev/null +++ b/provider/apps.py @@ -0,0 +1,7 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class ProviderConfig(AppConfig): + name = 'provider' diff --git a/provider/migrations/0001_initial.py b/provider/migrations/0001_initial.py new file mode 100644 index 0000000..2e3adf1 --- /dev/null +++ b/provider/migrations/0001_initial.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-02 19:51 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Provider', + fields=[ + ('id', models.IntegerField(primary_key=True, serialize=False)), + ('provider', models.CharField(max_length=64)), + ('name', models.CharField(db_index=True, max_length=255, unique=True)), + ('region', models.CharField(db_index=True, max_length=255, unique=True)), + ('project_id', models.CharField(db_index=True, max_length=255)), + ('default_role', models.CharField(max_length=255)), + ('default_domain_id', models.CharField(max_length=255)), + ('username', models.CharField(db_index=True, max_length=255, unique=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)), + ], + ), + ] diff --git a/provider/migrations/0002_auto_20161202_2042.py b/provider/migrations/0002_auto_20161202_2042.py new file mode 100644 index 0000000..ed2953e --- /dev/null +++ b/provider/migrations/0002_auto_20161202_2042.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-02 20:42 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('provider', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='provider', + name='id', + field=models.AutoField(primary_key=True, serialize=False), + ), + ] diff --git a/provider/migrations/0003_type.py b/provider/migrations/0003_type.py new file mode 100644 index 0000000..961660f --- /dev/null +++ b/provider/migrations/0003_type.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-04 10:00 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('provider', '0002_auto_20161202_2042'), + ] + + operations = [ + migrations.CreateModel( + name='Type', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('name', models.CharField(db_index=True, max_length=255, unique=True)), + ('type', models.CharField(choices=[('1', 'Public Cloud Provider'), ('2', 'Private Cloud Provider'), ('3', 'Container Provider'), ('4', 'VPS Provider')], max_length=1)), + ('logo', models.FileField(upload_to='static/provider-logo/')), + ], + ), + ] diff --git a/provider/migrations/__init__.py b/provider/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/provider/models.py b/provider/models.py new file mode 100644 index 0000000..f1f1f8c --- /dev/null +++ b/provider/models.py @@ -0,0 +1,62 @@ +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'), + ('2', 'Private Cloud Provider'), + ('3', 'Container Provider'), + ('4', 'VPS Provider'), + ) + id = models.AutoField(primary_key=True) + name = models.CharField( + max_length=255, + unique=True, + db_index=True + ) + type = models.CharField( + max_length=1, + choices=types + ) + logo = models.FileField(upload_to='static/provider-logo/') + + def __unicode__(self): + return self.name + diff --git a/provider/tests.py b/provider/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/provider/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/provider/views.py b/provider/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/provider/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. diff --git a/static/provider-logo/openstack-logo-1-300x150.png b/static/provider-logo/openstack-logo-1-300x150.png new file mode 100644 index 0000000..b6e1fb0 Binary files /dev/null and b/static/provider-logo/openstack-logo-1-300x150.png differ diff --git a/user_profile/migrations/0002_auto_20161201_2120.py b/user_profile/migrations/0002_auto_20161201_2120.py new file mode 100644 index 0000000..fe85a1f --- /dev/null +++ b/user_profile/migrations/0002_auto_20161201_2120.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.3 on 2016-12-01 21:20 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('user_profile', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='avatar', + field=models.FileField(upload_to='static/avatar/%Y-%m-%d'), + ), + ] diff --git a/user_profile/models.py b/user_profile/models.py index 383b793..1506fdd 100644 --- a/user_profile/models.py +++ b/user_profile/models.py @@ -5,7 +5,10 @@ from django.contrib.auth.models import User class Profile(models.Model): - user = models.OneToOneField(User, on_delete=models.CASCADE) + user = models.OneToOneField( + User, + on_delete=models.CASCADE + ) avatar = models.FileField(upload_to='static/avatar/%Y-%m-%d') provider_password = models.CharField(max_length=50) selected_provider = models.IntegerField() \ No newline at end of file