From ac47efec05b3820415bd26507e4b7fc520c6ebd6 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 31 Mar 2015 17:02:57 +0200 Subject: [PATCH] flushing the est of the material for django-1.7 see README.django-1.7 for more details essentially new-style migrations come in portal/native_migrations but this requires manual setup when running under 1.7 --- README.django-1.7 | 30 ++++++ myslice/settings.py | 12 ++- portal/native_migrations/0001_initial.py | 114 +++++++++++++++++++++++ portal/native_migrations/__init__.py | 0 4 files changed, 153 insertions(+), 3 deletions(-) create mode 100644 README.django-1.7 create mode 100644 portal/native_migrations/0001_initial.py create mode 100644 portal/native_migrations/__init__.py diff --git a/README.django-1.7 b/README.django-1.7 new file mode 100644 index 00000000..382c4227 --- /dev/null +++ b/README.django-1.7 @@ -0,0 +1,30 @@ +Thierry Parmentelat + +As of March 31 2015, the code should be mostly ready for django-1.7, +with the following restrictions + +* migrations : django-1.7 comes with its own native migrations system + and so south is not needed/recommended any longer. So for now we have a + version of such native migrations that does a one-shot setup of a db + schema but this is stored in + + portal/native_migrations + + instead of the standard location + + portal/migrations + + because this one is still expected to hold south code with earlier djangos + You might need to rename native_migrations/ into migrations/ before + running manage.py migrate in the first place + +* testing quite a few issues related to 1.7 have been addressed but it + would be presomptuous to state that things were tested very + thoroughly, far from that. + + So please use with care and let meknow of any additional issues + + + + + diff --git a/myslice/settings.py b/myslice/settings.py index 8c3f49e1..f4d0835b 100644 --- a/myslice/settings.py +++ b/myslice/settings.py @@ -249,8 +249,6 @@ INSTALLED_APPS = [ 'plugins', # views - more or less stable 'ui', - # managing database migrations - 'south', # Uncomment the next line to enable the admin: 'django.contrib.admin', # FORGE Plugin app @@ -259,8 +257,16 @@ INSTALLED_APPS = [ # 'django.contrib.admindocs', 'portal', ] +# with django-1.7 we leave south and use native migrations +# managing database migrations +import django +major, minor, _, _, _ = django.VERSION +if major == 1 and minor <= 6: + INSTALLED_APPS.append('south') + # this app won't load in a build environment -if not building: INSTALLED_APPS.append ('rest') +if not building: + INSTALLED_APPS.append ('rest') for component in components.list() : INSTALLED_APPS.append(component) diff --git a/portal/native_migrations/0001_initial.py b/portal/native_migrations/0001_initial.py new file mode 100644 index 00000000..d307a59c --- /dev/null +++ b/portal/native_migrations/0001_initial.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Institution', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.TextField()), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PendingAuthority', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('site_name', models.TextField()), + ('site_authority', models.TextField()), + ('site_abbreviated_name', models.TextField()), + ('site_url', models.TextField()), + ('site_latitude', models.TextField()), + ('site_longitude', models.TextField()), + ('address_line1', models.TextField()), + ('address_line2', models.TextField()), + ('address_line3', models.TextField()), + ('address_city', models.TextField()), + ('address_postalcode', models.TextField()), + ('address_state', models.TextField()), + ('address_country', models.TextField()), + ('authority_hrn', models.TextField()), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PendingJoin', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('user_hrn', models.TextField()), + ('email', models.TextField()), + ('project_name', models.TextField(null=True)), + ('authority_hrn', models.TextField()), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PendingProject', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('project_name', models.TextField()), + ('user_hrn', models.TextField()), + ('email', models.TextField()), + ('authority_hrn', models.TextField(null=True)), + ('purpose', models.TextField(default=b'NA')), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PendingSlice', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('slice_name', models.TextField()), + ('user_hrn', models.TextField()), + ('authority_hrn', models.TextField(null=True)), + ('number_of_nodes', models.TextField(default=0)), + ('type_of_nodes', models.TextField(default=b'NA')), + ('purpose', models.TextField(default=b'NA')), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PendingUser', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('first_name', models.TextField()), + ('last_name', models.TextField()), + ('email', models.EmailField(max_length=75)), + ('password', models.TextField()), + ('user_hrn', models.TextField()), + ('public_key', models.TextField()), + ('private_key', models.TextField()), + ('authority_hrn', models.TextField()), + ('login', models.TextField()), + ('pi', models.TextField()), + ('email_hash', models.TextField()), + ('status', models.TextField()), + ('created', models.DateTimeField(auto_now_add=True)), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/portal/native_migrations/__init__.py b/portal/native_migrations/__init__.py new file mode 100644 index 00000000..e69de29b -- 2.43.0