diff --git a/beat/web/algorithms/migrations/0004_auto_20160704_1109.py b/beat/web/algorithms/migrations/0004_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..c1ba409b4da74b22080d8bb2991845116068f10a --- /dev/null +++ b/beat/web/algorithms/migrations/0004_auto_20160704_1109.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('algorithms', '0003_auto_20160701_1707'), + ] + + operations = [ + migrations.AlterModelOptions( + name='algorithm', + options={'ordering': ['author__username', 'name', 'version']}, + ), + ] diff --git a/beat/web/common/models.py b/beat/web/common/models.py index 382330ff779568845238d2988e4ba74a14a2ae55..66e680a071844d6d34f3280d3cfd6e300e104701 100644 --- a/beat/web/common/models.py +++ b/beat/web/common/models.py @@ -381,9 +381,7 @@ class Versionable(Shareable): class Meta(Shareable.Meta): abstract = True - - # setup ordering so that the dump order respects self dependencies - ordering = ['version', 'id'] + ordering = ['name', '-version'] #_____ Static Methods __________ @@ -554,6 +552,7 @@ class Contribution(Versionable): class Meta(Versionable.Meta): abstract = True + ordering = ['author__username', 'name', 'version'] unique_together = ('author', 'name', 'version') diff --git a/beat/web/databases/migrations/0005_auto_20160704_1109.py b/beat/web/databases/migrations/0005_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..08830e32711fe17c395e293e764081ad20bb10ae --- /dev/null +++ b/beat/web/databases/migrations/0005_auto_20160704_1109.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('databases', '0004_auto_20160701_1707'), + ] + + operations = [ + migrations.AlterModelOptions( + name='database', + options={'ordering': ['name', '-version']}, + ), + ] diff --git a/beat/web/databases/models.py b/beat/web/databases/models.py index eeba459ca0dda08492bd47f9482421a0e196e72b..c4cb27213f48cf0987040d07b085d4e73fea90e0 100755 --- a/beat/web/databases/models.py +++ b/beat/web/databases/models.py @@ -192,11 +192,6 @@ class Database(Versionable): class Meta(Versionable.Meta): unique_together = ('name', 'version') - # setup ordering so that the dump order respects self dependencies - # note: Versionable already has the right ordering - not sure why - # `django makemigrations' is not detecting it though. - ordering = ['version', 'id'] - #_____ Utilities __________ diff --git a/beat/web/dataformats/migrations/0003_auto_20160704_1109.py b/beat/web/dataformats/migrations/0003_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..b434ca0369990313e44d93dbed20d4806d821998 --- /dev/null +++ b/beat/web/dataformats/migrations/0003_auto_20160704_1109.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('dataformats', '0002_auto_20160701_1712'), + ] + + operations = [ + migrations.AlterModelOptions( + name='dataformat', + options={'ordering': ['author__username', 'name', 'version'], 'verbose_name': 'dataformat', 'verbose_name_plural': 'dataformats'}, + ), + ] diff --git a/beat/web/libraries/migrations/0004_auto_20160704_1109.py b/beat/web/libraries/migrations/0004_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..6d541b08d88a4816f1e15d9ebce2130c1a423791 --- /dev/null +++ b/beat/web/libraries/migrations/0004_auto_20160704_1109.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('libraries', '0003_auto_20160701_1707'), + ] + + operations = [ + migrations.AlterModelOptions( + name='library', + options={'ordering': ['author__username', 'name', 'version'], 'verbose_name_plural': 'libraries'}, + ), + ] diff --git a/beat/web/plotters/migrations/0004_auto_20160704_1109.py b/beat/web/plotters/migrations/0004_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..e7de401066190647f2e4a9da1431cfbf4141061c --- /dev/null +++ b/beat/web/plotters/migrations/0004_auto_20160704_1109.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('plotters', '0003_auto_20160701_1707'), + ] + + operations = [ + migrations.AlterModelOptions( + name='plotter', + options={'ordering': ['author__username', 'name', 'version']}, + ), + migrations.AlterModelOptions( + name='plotterparameter', + options={'ordering': ['author__username', 'name', 'version']}, + ), + ] diff --git a/beat/web/toolchains/migrations/0004_auto_20160704_1109.py b/beat/web/toolchains/migrations/0004_auto_20160704_1109.py new file mode 100644 index 0000000000000000000000000000000000000000..555d2d6dc9e6d2ab96adfcbcf7a7380e6e67c2ad --- /dev/null +++ b/beat/web/toolchains/migrations/0004_auto_20160704_1109.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.5 on 2016-07-04 11:09 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('toolchains', '0003_auto_20160701_1707'), + ] + + operations = [ + migrations.AlterModelOptions( + name='toolchain', + options={'ordering': ['author__username', 'name', 'version']}, + ), + ] diff --git a/beat/web/utils/management/commands/backup.py b/beat/web/utils/management/commands/backup.py index 3c0598ab03274ad7819258276ada1fa3d4ff2993..1245b207e23041d625e5b78c723d5ab01bb49870 100644 --- a/beat/web/utils/management/commands/backup.py +++ b/beat/web/utils/management/commands/backup.py @@ -149,7 +149,7 @@ class Command(BaseCommand): destfile = os.path.join(tmpdir, 'initial.json') logger.info("Dumping initial (unspecified) data -> `%s'", destfile) arguments['output'] = destfile #new in Django-1.8.x - call_command('beatdump', **arguments) + call_command('xdumpdata', **arguments) # and backs-up the apps respecting the imposed order for app in use_apps: @@ -159,7 +159,7 @@ class Command(BaseCommand): logger.info("Dumping data for `%s' -> `%s'", app, destfile) arguments['output'] = destfile #new in Django-1.8.x - call_command('beatdump', only.get(app, app), **arguments) + call_command('xdumpdata', only.get(app, app), **arguments) # copy prefix data path = os.path.join(settings.PREFIX, app) diff --git a/beat/web/utils/management/commands/beatdump.py b/beat/web/utils/management/commands/xdumpdata.py similarity index 93% rename from beat/web/utils/management/commands/beatdump.py rename to beat/web/utils/management/commands/xdumpdata.py index 76f1886fbf7b8105feafc043b7878817cabee159..fcddbea38215fa9d8ebba41f0816c4a1f1920bbe 100644 --- a/beat/web/utils/management/commands/beatdump.py +++ b/beat/web/utils/management/commands/xdumpdata.py @@ -150,14 +150,19 @@ class Command(BaseCommand): else: objects = model._default_manager - # BEAT PATCH: let default order take place + # ################################################### + # patch for BEAT starts here: respect self ordering + # ################################################### queryset = objects.using(using) - # ORIGINAL LINE - #queryset = objects.using(using).order_by(model._meta.pk.name) if primary_keys: - queryset = queryset.filter(pk__in=primary_keys) - if count_only: + # in case the user specifies PKs, respect order + for pk in [int(k) for k in primary_keys]: + yield queryset.get(pk=pk) + elif count_only: + # ################################################### + # patch for BEAT ends here + # ################################################### yield queryset.order_by().count() else: for obj in queryset.iterator():