From 9b92cedae929865ce297016eb29bacf00168c42d Mon Sep 17 00:00:00 2001 From: Mikko Nieminen Date: Tue, 16 Jul 2024 13:18:02 +0200 Subject: [PATCH] reformat squashed migrations (#1446) --- ...01_squashed_0032_alter_appsetting_value.py | 815 +++++++++++++++--- .../0001_squashed_0015_make_uuid_unique.py | 226 ++++- 2 files changed, 910 insertions(+), 131 deletions(-) diff --git a/projectroles/migrations/0001_squashed_0032_alter_appsetting_value.py b/projectroles/migrations/0001_squashed_0032_alter_appsetting_value.py index b24010d6..77b7bf79 100644 --- a/projectroles/migrations/0001_squashed_0032_alter_appsetting_value.py +++ b/projectroles/migrations/0001_squashed_0032_alter_appsetting_value.py @@ -24,23 +24,27 @@ def save_role(name, description): 'project owner', 'The project owner has full access to project data; rights to add, ' 'modify and remove project members; right to assign a project ' - 'delegate. Each project must have exactly one owner.') + 'delegate. Each project must have exactly one owner.', + ) # Delegate save_role( 'project delegate', 'The project delegate has all the rights of a project owner with the ' 'exception of assigning a delegate. A maximum of one delegate can be ' - 'set per project. A delegate role can be set by project owner.') + 'set per project. A delegate role can be set by project owner.', + ) # Contributor save_role( 'project contributor', 'A project member with ability to view and add project data. Can edit ' - 'their own data.') + 'their own data.', + ) # Guest save_role( 'project guest', 'Read-only access to a project. Can view data in project, can not add ' - 'or edit.') + 'or edit.', + ) def fix_remote_project_keys(apps, schema_editor): @@ -129,6 +133,7 @@ def migrate_project_stars(apps, schema_editor): def delete_category_app_settings(apps, schema_editor): """Delete app settings assigned to categories""" from projectroles.app_settings import AppSettingAPI + app_settings = AppSettingAPI() AppSetting = apps.get_model('projectroles', 'AppSetting') # Find all app settings whith a project @@ -164,7 +169,7 @@ def populate_finder_role(apps, schema_editor): 'categories and projects under a category for this role is given. ' 'They will not have access to the apps or data of those subprojects or ' 'categories until assigned a higher role. This role can only be ' - 'assigned for categories.' + 'assigned for categories.', ) role.save() @@ -240,7 +245,7 @@ class Migration(migrations.Migration): ('projectroles', '0029_sodaruseradditionalemail'), ('projectroles', '0030_populate_sodaruseradditionalemail'), ('projectroles', '0031_remotesite_owner_modifiable'), - ('projectroles', '0032_alter_appsetting_value') + ('projectroles', '0032_alter_appsetting_value'), ] initial = True @@ -254,16 +259,92 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Project', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(help_text='Project title', max_length=255)), - ('type', models.CharField(choices=[('CATEGORY', 'Category'), ('PROJECT', 'Project')], default='PROJECT', help_text='Type of project ("CATEGORY", "PROJECT")', max_length=64)), - ('description', models.CharField(help_text='Short project description', max_length=512)), - ('readme', markupfield.fields.MarkupField(blank=True, help_text='Project README (optional, supports markdown)', null=True, rendered_field=True)), - ('readme_markup_type', models.CharField(choices=[('', '--'), ('html', 'HTML'), ('plain', 'Plain'), ('markdown', 'Markdown'), ('restructuredtext', 'Restructured Text')], default='markdown', editable=False, max_length=30)), - ('submit_status', models.CharField(default='OK', help_text='Status of project creation', max_length=64)), - ('_readme_rendered', models.TextField(editable=False, null=True)), - ('omics_uuid', models.UUIDField(default=uuid.uuid4, help_text='Project Omics UUID', unique=True)), - ('parent', models.ForeignKey(blank=True, help_text='Parent category if nested', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='projectroles.project')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'title', + models.CharField(help_text='Project title', max_length=255), + ), + ( + 'type', + models.CharField( + choices=[ + ('CATEGORY', 'Category'), + ('PROJECT', 'Project'), + ], + default='PROJECT', + help_text='Type of project ("CATEGORY", "PROJECT")', + max_length=64, + ), + ), + ( + 'description', + models.CharField( + help_text='Short project description', max_length=512 + ), + ), + ( + 'readme', + markupfield.fields.MarkupField( + blank=True, + help_text='Project README (optional, supports markdown)', + null=True, + rendered_field=True, + ), + ), + ( + 'readme_markup_type', + models.CharField( + choices=[ + ('', '--'), + ('html', 'HTML'), + ('plain', 'Plain'), + ('markdown', 'Markdown'), + ('restructuredtext', 'Restructured Text'), + ], + default='markdown', + editable=False, + max_length=30, + ), + ), + ( + 'submit_status', + models.CharField( + default='OK', + help_text='Status of project creation', + max_length=64, + ), + ), + ( + '_readme_rendered', + models.TextField(editable=False, null=True), + ), + ( + 'omics_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='Project Omics UUID', + unique=True, + ), + ), + ( + 'parent', + models.ForeignKey( + blank=True, + help_text='Parent category if nested', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='children', + to='projectroles.project', + ), + ), ], options={ 'ordering': ['parent__title', 'title'], @@ -273,19 +354,70 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Role', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(help_text='Name of role', max_length=64, unique=True)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + help_text='Name of role', max_length=64, unique=True + ), + ), ('description', models.TextField(help_text='Role description')), ], ), migrations.CreateModel( name='ProjectUserTag', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(default='STARRED', help_text='Name of tag to be assigned', max_length=64)), - ('omics_uuid', models.UUIDField(default=uuid.uuid4, help_text='ProjectUserTag Omics UUID', unique=True)), - ('project', models.ForeignKey(help_text='Project in which the tag is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='tags', to='projectroles.project')), - ('user', models.ForeignKey(help_text='User for whom the tag is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='project_tags', to=settings.AUTH_USER_MODEL)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + default='STARRED', + help_text='Name of tag to be assigned', + max_length=64, + ), + ), + ( + 'omics_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='ProjectUserTag Omics UUID', + unique=True, + ), + ), + ( + 'project', + models.ForeignKey( + help_text='Project in which the tag is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='tags', + to='projectroles.project', + ), + ), + ( + 'user', + models.ForeignKey( + help_text='User for whom the tag is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='project_tags', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'ordering': ['project__title', 'user__username', 'name'], @@ -294,17 +426,91 @@ class Migration(migrations.Migration): migrations.CreateModel( name='ProjectInvite', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('email', models.EmailField(help_text='Email address of the person to be invited', max_length=254)), - ('date_created', models.DateTimeField(auto_now_add=True, help_text='DateTime of invite creation')), - ('date_expire', models.DateTimeField(help_text='Expiration of invite as DateTime')), - ('message', models.TextField(blank=True, help_text='Message to be included in the invite email (optional)')), - ('secret', models.CharField(help_text='Secret token provided to user with the invite', max_length=255, unique=True)), - ('active', models.BooleanField(default=True, help_text='Status of the invite (False if claimed or revoked)')), - ('omics_uuid', models.UUIDField(default=uuid.uuid4, help_text='ProjectInvite Omics UUID', unique=True)), - ('issuer', models.ForeignKey(help_text='User who issued the invite', on_delete=django.db.models.deletion.CASCADE, related_name='issued_invites', to=settings.AUTH_USER_MODEL)), - ('project', models.ForeignKey(help_text='Project to which the person is invited', on_delete=django.db.models.deletion.CASCADE, related_name='invites', to='projectroles.project')), - ('role', models.ForeignKey(help_text='Role assigned to the person', on_delete=django.db.models.deletion.CASCADE, to='projectroles.role')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'email', + models.EmailField( + help_text='Email address of the person to be invited', + max_length=254, + ), + ), + ( + 'date_created', + models.DateTimeField( + auto_now_add=True, + help_text='DateTime of invite creation', + ), + ), + ( + 'date_expire', + models.DateTimeField( + help_text='Expiration of invite as DateTime' + ), + ), + ( + 'message', + models.TextField( + blank=True, + help_text='Message to be included in the invite email (optional)', + ), + ), + ( + 'secret', + models.CharField( + help_text='Secret token provided to user with the invite', + max_length=255, + unique=True, + ), + ), + ( + 'active', + models.BooleanField( + default=True, + help_text='Status of the invite (False if claimed or revoked)', + ), + ), + ( + 'omics_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='ProjectInvite Omics UUID', + unique=True, + ), + ), + ( + 'issuer', + models.ForeignKey( + help_text='User who issued the invite', + on_delete=django.db.models.deletion.CASCADE, + related_name='issued_invites', + to=settings.AUTH_USER_MODEL, + ), + ), + ( + 'project', + models.ForeignKey( + help_text='Project to which the person is invited', + on_delete=django.db.models.deletion.CASCADE, + related_name='invites', + to='projectroles.project', + ), + ), + ( + 'role', + models.ForeignKey( + help_text='Role assigned to the person', + on_delete=django.db.models.deletion.CASCADE, + to='projectroles.role', + ), + ), ], options={ 'ordering': ['project__title', 'email', 'role__name'], @@ -313,27 +519,134 @@ class Migration(migrations.Migration): migrations.CreateModel( name='RoleAssignment', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('omics_uuid', models.UUIDField(default=uuid.uuid4, help_text='RoleAssignment Omics UUID', unique=True)), - ('project', models.ForeignKey(help_text='Project in which role is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='roles', to='projectroles.project')), - ('role', models.ForeignKey(help_text='Role to be assigned', on_delete=django.db.models.deletion.CASCADE, related_name='assignments', to='projectroles.role')), - ('user', models.ForeignKey(help_text='User for whom role is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='roles', to=settings.AUTH_USER_MODEL)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'omics_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='RoleAssignment Omics UUID', + unique=True, + ), + ), + ( + 'project', + models.ForeignKey( + help_text='Project in which role is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='roles', + to='projectroles.project', + ), + ), + ( + 'role', + models.ForeignKey( + help_text='Role to be assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='assignments', + to='projectroles.role', + ), + ), + ( + 'user', + models.ForeignKey( + help_text='User for whom role is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='roles', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ - 'ordering': ['project__parent__title', 'project__title', 'role__name', 'user__username'], - 'indexes': [models.Index(fields=['project'], name='projectrole_project_b13795_idx'), models.Index(fields=['user'], name='projectrole_user_id_0e46f7_idx')], + 'ordering': [ + 'project__parent__title', + 'project__title', + 'role__name', + 'user__username', + ], + 'indexes': [ + models.Index( + fields=['project'], + name='projectrole_project_b13795_idx', + ), + models.Index( + fields=['user'], name='projectrole_user_id_0e46f7_idx' + ), + ], }, ), migrations.CreateModel( name='ProjectSetting', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(help_text='Name of the setting', max_length=255)), - ('type', models.CharField(choices=[('BOOLEAN', 'Boolean'), ('INTEGER', 'Integer'), ('STRING', 'String')], help_text='Type of the setting', max_length=64)), - ('value', models.CharField(blank=True, help_text='Value of the setting', max_length=255, null=True)), - ('omics_uuid', models.UUIDField(default=uuid.uuid4, help_text='ProjectSetting Omics UUID', unique=True)), - ('app_plugin', models.ForeignKey(help_text='App to which the setting belongs', on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='djangoplugins.plugin')), - ('project', models.ForeignKey(help_text='Project to which the setting belongs', on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='projectroles.project')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + help_text='Name of the setting', max_length=255 + ), + ), + ( + 'type', + models.CharField( + choices=[ + ('BOOLEAN', 'Boolean'), + ('INTEGER', 'Integer'), + ('STRING', 'String'), + ], + help_text='Type of the setting', + max_length=64, + ), + ), + ( + 'value', + models.CharField( + blank=True, + help_text='Value of the setting', + max_length=255, + null=True, + ), + ), + ( + 'omics_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='ProjectSetting Omics UUID', + unique=True, + ), + ), + ( + 'app_plugin', + models.ForeignKey( + help_text='App to which the setting belongs', + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='djangoplugins.plugin', + ), + ), + ( + 'project', + models.ForeignKey( + help_text='Project to which the setting belongs', + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='projectroles.project', + ), + ), ], options={ 'ordering': ['project__title', 'app_plugin__name', 'name'], @@ -372,43 +685,97 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='project', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='Project SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, help_text='Project SODAR UUID', unique=True + ), ), migrations.AlterField( model_name='projectinvite', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='ProjectInvite SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='ProjectInvite SODAR UUID', + unique=True, + ), ), migrations.AlterField( model_name='projectsetting', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='ProjectSetting SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='ProjectSetting SODAR UUID', + unique=True, + ), ), migrations.AlterField( model_name='projectusertag', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='ProjectUserTag SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='ProjectUserTag SODAR UUID', + unique=True, + ), ), migrations.AlterField( model_name='roleassignment', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='RoleAssignment SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='RoleAssignment SODAR UUID', + unique=True, + ), ), migrations.AlterField( model_name='project', name='description', - field=models.CharField(blank=True, help_text='Short project description', max_length=512, null=True), + field=models.CharField( + blank=True, + help_text='Short project description', + max_length=512, + null=True, + ), ), migrations.CreateModel( name='RemoteSite', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(help_text='Site name', max_length=255, unique=True)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + help_text='Site name', max_length=255, unique=True + ), + ), ('url', models.URLField(help_text='Site URL', max_length=2000)), - ('mode', models.CharField(default='TARGET', help_text='Site mode', max_length=64)), + ( + 'mode', + models.CharField( + default='TARGET', help_text='Site mode', max_length=64 + ), + ), ('description', models.TextField(help_text='Site description')), - ('secret', models.CharField(help_text='Secret token for connecting to the source site', max_length=255)), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='RemoteSite relation UUID (local)', unique=True)), + ( + 'secret', + models.CharField( + help_text='Secret token for connecting to the source site', + max_length=255, + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='RemoteSite relation UUID (local)', + unique=True, + ), + ), ], options={ 'ordering': ['name'], @@ -418,13 +785,62 @@ class Migration(migrations.Migration): migrations.CreateModel( name='RemoteProject', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('project_uuid', models.UUIDField(default=None, help_text='Project UUID')), - ('level', models.CharField(default='NONE', help_text='Project access level', max_length=255)), - ('date_access', models.DateTimeField(help_text='DateTime of last access from/to remote site', null=True)), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='RemoteProject relation UUID (local)', unique=True)), - ('project', models.ForeignKey(blank=True, help_text='Related project object (if created locally)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='remotes', to='projectroles.project')), - ('site', models.ForeignKey(help_text='Remote SODAR site', on_delete=django.db.models.deletion.CASCADE, related_name='projects', to='projectroles.remotesite')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'project_uuid', + models.UUIDField(default=None, help_text='Project UUID'), + ), + ( + 'level', + models.CharField( + default='NONE', + help_text='Project access level', + max_length=255, + ), + ), + ( + 'date_access', + models.DateTimeField( + help_text='DateTime of last access from/to remote site', + null=True, + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='RemoteProject relation UUID (local)', + unique=True, + ), + ), + ( + 'project', + models.ForeignKey( + blank=True, + help_text='Related project object (if created locally)', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='remotes', + to='projectroles.project', + ), + ), + ( + 'site', + models.ForeignKey( + help_text='Remote SODAR site', + on_delete=django.db.models.deletion.CASCADE, + related_name='projects', + to='projectroles.remotesite', + ), + ), ], options={ 'ordering': ['site__name', 'project_uuid'], @@ -437,26 +853,118 @@ class Migration(migrations.Migration): migrations.AddField( model_name='projectsetting', name='user', - field=models.ForeignKey(blank=True, help_text='User to which the setting belongs', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_settings', to=settings.AUTH_USER_MODEL), + field=models.ForeignKey( + blank=True, + help_text='User to which the setting belongs', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='user_settings', + to=settings.AUTH_USER_MODEL, + ), ), migrations.AlterField( model_name='projectsetting', name='project', - field=models.ForeignKey(blank=True, help_text='Project to which the setting belongs', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='projectroles.project'), + field=models.ForeignKey( + blank=True, + help_text='Project to which the setting belongs', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='projectroles.project', + ), ), migrations.CreateModel( name='AppSetting', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(help_text='Name of the setting', max_length=255)), - ('type', models.CharField(choices=[('BOOLEAN', 'Boolean'), ('INTEGER', 'Integer'), ('STRING', 'String')], help_text='Type of the setting', max_length=64)), - ('value', models.CharField(blank=True, help_text='Value of the setting', max_length=255, null=True)), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='AppSetting SODAR UUID', unique=True)), - ('app_plugin', models.ForeignKey(help_text='App to which the setting belongs', on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='djangoplugins.plugin')), - ('project', models.ForeignKey(blank=True, help_text='Project to which the setting belongs', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='projectroles.project')), - ('user', models.ForeignKey(blank=True, help_text='User to which the setting belongs', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='user_settings', to=settings.AUTH_USER_MODEL)), - ('user_modifiable', models.BooleanField(default=True, help_text='Setting visibility in forms')), - ('value_json', django.contrib.postgres.fields.jsonb.JSONField(default=dict, help_text='Optional JSON value for the setting')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'name', + models.CharField( + help_text='Name of the setting', max_length=255 + ), + ), + ( + 'type', + models.CharField( + choices=[ + ('BOOLEAN', 'Boolean'), + ('INTEGER', 'Integer'), + ('STRING', 'String'), + ], + help_text='Type of the setting', + max_length=64, + ), + ), + ( + 'value', + models.CharField( + blank=True, + help_text='Value of the setting', + max_length=255, + null=True, + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='AppSetting SODAR UUID', + unique=True, + ), + ), + ( + 'app_plugin', + models.ForeignKey( + help_text='App to which the setting belongs', + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='djangoplugins.plugin', + ), + ), + ( + 'project', + models.ForeignKey( + blank=True, + help_text='Project to which the setting belongs', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='projectroles.project', + ), + ), + ( + 'user', + models.ForeignKey( + blank=True, + help_text='User to which the setting belongs', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='user_settings', + to=settings.AUTH_USER_MODEL, + ), + ), + ( + 'user_modifiable', + models.BooleanField( + default=True, help_text='Setting visibility in forms' + ), + ), + ( + 'value_json', + django.contrib.postgres.fields.jsonb.JSONField( + default=dict, + help_text='Optional JSON value for the setting', + ), + ), ], options={ 'ordering': ['project__title', 'app_plugin__name', 'name'], @@ -477,22 +985,34 @@ class Migration(migrations.Migration): migrations.AddField( model_name='remotesite', name='user_display', - field=models.BooleanField(default=True, help_text='RemoteSite visibility to users'), + field=models.BooleanField( + default=True, help_text='RemoteSite visibility to users' + ), ), migrations.AlterField( model_name='remotesite', name='secret', - field=models.CharField(help_text='Secret token for connecting to the source site', max_length=255, null=True), + field=models.CharField( + help_text='Secret token for connecting to the source site', + max_length=255, + null=True, + ), ), migrations.AlterField( model_name='appsetting', name='type', - field=models.CharField(help_text='Type of the setting', max_length=64), + field=models.CharField( + help_text='Type of the setting', max_length=64 + ), ), migrations.AlterField( model_name='appsetting', name='value_json', - field=django.contrib.postgres.fields.jsonb.JSONField(default=dict, help_text='Optional JSON value for the setting', null=True), + field=django.contrib.postgres.fields.jsonb.JSONField( + default=dict, + help_text='Optional JSON value for the setting', + null=True, + ), ), migrations.AlterUniqueTogether( name='appsetting', @@ -501,12 +1021,22 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='appsetting', name='app_plugin', - field=models.ForeignKey(help_text='App to which the setting belongs', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='settings', to='djangoplugins.plugin'), + field=models.ForeignKey( + help_text='App to which the setting belongs', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='settings', + to='djangoplugins.plugin', + ), ), migrations.AddField( model_name='project', name='full_title', - field=models.CharField(help_text='Full project title with parent path (auto-generated)', max_length=4096, null=True), + field=models.CharField( + help_text='Full project title with parent path (auto-generated)', + max_length=4096, + null=True, + ), ), migrations.RunPython( code=populate_project_full_title, @@ -515,17 +1045,27 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='appsetting', name='value_json', - field=models.JSONField(default=dict, help_text='Optional JSON value for the setting', null=True), + field=models.JSONField( + default=dict, + help_text='Optional JSON value for the setting', + null=True, + ), ), migrations.AddField( model_name='project', name='public_guest_access', - field=models.BooleanField(default=False, help_text='Allow public guest access for the project, also including unauthenticated users if allowed on the site'), + field=models.BooleanField( + default=False, + help_text='Allow public guest access for the project, also including unauthenticated users if allowed on the site', + ), ), migrations.AddField( model_name='project', name='has_public_children', - field=models.BooleanField(default=False, help_text='Whether project has children with public access (auto-generated)'), + field=models.BooleanField( + default=False, + help_text='Whether project has children with public access (auto-generated)', + ), ), migrations.RunPython( code=populate_public_children, @@ -538,7 +1078,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='role', name='rank', - field=models.IntegerField(default=0, help_text='Role rank for determining role hierarchy'), + field=models.IntegerField( + default=0, help_text='Role rank for determining role hierarchy' + ), ), migrations.RunPython( code=set_role_ranks, @@ -547,7 +1089,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='project', name='archive', - field=models.BooleanField(default=False, help_text='Project is archived (read-only)'), + field=models.BooleanField( + default=False, help_text='Project is archived (read-only)' + ), ), migrations.RunPython( code=migrate_project_stars, @@ -563,12 +1107,22 @@ class Migration(migrations.Migration): migrations.AddField( model_name='role', name='project_types', - field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(max_length=64), default=projectroles.models.get_role_project_type_default, help_text='Allowed project types for the role', size=None), + field=django.contrib.postgres.fields.ArrayField( + base_field=models.CharField(max_length=64), + default=projectroles.models.get_role_project_type_default, + help_text='Allowed project types for the role', + size=None, + ), ), migrations.AlterField( model_name='roleassignment', name='project', - field=models.ForeignKey(help_text='Project in which role is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='local_roles', to='projectroles.project'), + field=models.ForeignKey( + help_text='Project in which role is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='local_roles', + to='projectroles.project', + ), ), migrations.RunPython( code=populate_finder_role, @@ -577,14 +1131,64 @@ class Migration(migrations.Migration): migrations.CreateModel( name='SODARUserAdditionalEmail', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('email', models.EmailField(help_text='Email address', max_length=254)), - ('verified', models.BooleanField(default=False, help_text='Email verification status')), - ('secret', models.CharField(help_text='Secret token for email verification', max_length=255, unique=True)), - ('date_created', models.DateTimeField(auto_now_add=True, help_text='DateTime of creation')), - ('date_modified', models.DateTimeField(auto_now=True, help_text='DateTime of last modification')), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='SODARUserAdditionalEmail SODAR UUID', unique=True)), - ('user', models.ForeignKey(help_text='User for whom the email is assigned', on_delete=django.db.models.deletion.CASCADE, related_name='additional_emails', to=settings.AUTH_USER_MODEL)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'email', + models.EmailField( + help_text='Email address', max_length=254 + ), + ), + ( + 'verified', + models.BooleanField( + default=False, help_text='Email verification status' + ), + ), + ( + 'secret', + models.CharField( + help_text='Secret token for email verification', + max_length=255, + unique=True, + ), + ), + ( + 'date_created', + models.DateTimeField( + auto_now_add=True, help_text='DateTime of creation' + ), + ), + ( + 'date_modified', + models.DateTimeField( + auto_now=True, help_text='DateTime of last modification' + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='SODARUserAdditionalEmail SODAR UUID', + unique=True, + ), + ), + ( + 'user', + models.ForeignKey( + help_text='User for whom the email is assigned', + on_delete=django.db.models.deletion.CASCADE, + related_name='additional_emails', + to=settings.AUTH_USER_MODEL, + ), + ), ], options={ 'ordering': ['user__username', 'email'], @@ -598,16 +1202,23 @@ class Migration(migrations.Migration): migrations.AddField( model_name='remotesite', name='owner_modifiable', - field=models.BooleanField(default=True, help_text='Allow owners and delegates to modify project access for this site'), + field=models.BooleanField( + default=True, + help_text='Allow owners and delegates to modify project access for this site', + ), ), migrations.AlterField( model_name='remotesite', name='user_display', - field=models.BooleanField(default=True, help_text='Display site to users'), + field=models.BooleanField( + default=True, help_text='Display site to users' + ), ), migrations.AlterField( model_name='appsetting', name='value', - field=models.CharField(blank=True, help_text='Value of the setting', null=True), + field=models.CharField( + blank=True, help_text='Value of the setting', null=True + ), ), ] diff --git a/timeline/migrations/0001_squashed_0015_make_uuid_unique.py b/timeline/migrations/0001_squashed_0015_make_uuid_unique.py index c039474b..186d6293 100644 --- a/timeline/migrations/0001_squashed_0015_make_uuid_unique.py +++ b/timeline/migrations/0001_squashed_0015_make_uuid_unique.py @@ -16,7 +16,9 @@ def populate_event_status_uuid(apps, schema_editor): def populate_object_ref_uuid(apps, schema_editor): """Populate TimelineEventObjectRef sodar_uuid fields""" - TimelineEventObjectRef = apps.get_model('timeline', 'TimelineEventObjectRef') + TimelineEventObjectRef = apps.get_model( + 'timeline', 'TimelineEventObjectRef' + ) for status in TimelineEventObjectRef.objects.all(): status.sodar_uuid = uuid.uuid4() status.save(update_fields=['sodar_uuid']) @@ -28,6 +30,7 @@ def populate_object_ref_uuid(apps, schema_editor): # timeline.migrations.0010_populate_uuid # timeline.migrations.0014_populate_uuid + class Migration(migrations.Migration): replaces = [ @@ -45,7 +48,7 @@ class Migration(migrations.Migration): ('timeline', '0012_rename_models'), ('timeline', '0013_timelineeventobjectref_sodar_uuid'), ('timeline', '0014_populate_uuid'), - ('timeline', '0015_make_uuid_unique') + ('timeline', '0015_make_uuid_unique'), ] initial = True @@ -61,40 +64,195 @@ class Migration(migrations.Migration): migrations.CreateModel( name='ProjectEvent', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('app', models.CharField(help_text='App from which the event was triggered', max_length=255)), - ('event_name', models.CharField(help_text='Event ID string', max_length=255)), - ('description', models.TextField(help_text='Description of status change (may include {object label} references)')), - ('extra_data', models.JSONField(default=dict, help_text='Additional event data as JSON')), - ('classified', models.BooleanField(default=False, help_text='Event is classified (only viewable by user levels specified in rules)')), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='Event SODAR UUID', unique=True)), - ('project', models.ForeignKey(help_text='Project to which the event belongs (null for no project)', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='events', to='projectroles.project')), - ('user', models.ForeignKey(help_text='User who initiated the event (optional)', null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ('plugin', models.CharField(blank=True, help_text='Plugin to which the event is related (optional, if unset plugin with the name of the app is assumed)', max_length=255, null=True)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'app', + models.CharField( + help_text='App from which the event was triggered', + max_length=255, + ), + ), + ( + 'event_name', + models.CharField( + help_text='Event ID string', max_length=255 + ), + ), + ( + 'description', + models.TextField( + help_text='Description of status change (may include {object label} references)' + ), + ), + ( + 'extra_data', + models.JSONField( + default=dict, help_text='Additional event data as JSON' + ), + ), + ( + 'classified', + models.BooleanField( + default=False, + help_text='Event is classified (only viewable by user levels specified in rules)', + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='Event SODAR UUID', + unique=True, + ), + ), + ( + 'project', + models.ForeignKey( + help_text='Project to which the event belongs (null for no project)', + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name='events', + to='projectroles.project', + ), + ), + ( + 'user', + models.ForeignKey( + help_text='User who initiated the event (optional)', + null=True, + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ( + 'plugin', + models.CharField( + blank=True, + help_text='Plugin to which the event is related (optional, if unset plugin with the name of the app is assumed)', + max_length=255, + null=True, + ), + ), ], ), migrations.CreateModel( name='ProjectEventObjectRef', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.CharField(help_text='Label for the object related to the event', max_length=255)), - ('name', models.CharField(help_text='Name or title of the object', max_length=255)), - ('object_model', models.CharField(help_text='Object model as string', max_length=255)), - ('object_uuid', models.UUIDField(blank=True, help_text='Object SODAR UUID', null=True)), - ('extra_data', models.JSONField(default=dict, help_text='Additional data related to the object as JSON')), - ('event', models.ForeignKey(help_text='Event to which the object belongs', on_delete=django.db.models.deletion.CASCADE, related_name='event_objects', to='timeline.projectevent')), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'label', + models.CharField( + help_text='Label for the object related to the event', + max_length=255, + ), + ), + ( + 'name', + models.CharField( + help_text='Name or title of the object', max_length=255 + ), + ), + ( + 'object_model', + models.CharField( + help_text='Object model as string', max_length=255 + ), + ), + ( + 'object_uuid', + models.UUIDField( + blank=True, help_text='Object SODAR UUID', null=True + ), + ), + ( + 'extra_data', + models.JSONField( + default=dict, + help_text='Additional data related to the object as JSON', + ), + ), + ( + 'event', + models.ForeignKey( + help_text='Event to which the object belongs', + on_delete=django.db.models.deletion.CASCADE, + related_name='event_objects', + to='timeline.projectevent', + ), + ), ], ), migrations.CreateModel( name='ProjectEventStatus', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('timestamp', models.DateTimeField(auto_now_add=True, help_text='DateTime of the status change')), - ('status_type', models.CharField(help_text='Type of the status change', max_length=64)), - ('description', models.TextField(blank=True, help_text='Description of status change (optional)')), - ('extra_data', models.JSONField(default=dict, help_text='Additional status data as JSON')), - ('event', models.ForeignKey(help_text='Event to which the status change belongs', on_delete=django.db.models.deletion.CASCADE, related_name='status_changes', to='timeline.projectevent')), - ('sodar_uuid', models.UUIDField(default=uuid.uuid4, help_text='Status SODAR UUID', null=True)), + ( + 'id', + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name='ID', + ), + ), + ( + 'timestamp', + models.DateTimeField( + auto_now_add=True, + help_text='DateTime of the status change', + ), + ), + ( + 'status_type', + models.CharField( + help_text='Type of the status change', max_length=64 + ), + ), + ( + 'description', + models.TextField( + blank=True, + help_text='Description of status change (optional)', + ), + ), + ( + 'extra_data', + models.JSONField( + default=dict, help_text='Additional status data as JSON' + ), + ), + ( + 'event', + models.ForeignKey( + help_text='Event to which the status change belongs', + on_delete=django.db.models.deletion.CASCADE, + related_name='status_changes', + to='timeline.projectevent', + ), + ), + ( + 'sodar_uuid', + models.UUIDField( + default=uuid.uuid4, + help_text='Status SODAR UUID', + null=True, + ), + ), ], ), migrations.RunPython( @@ -104,7 +262,9 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='projecteventstatus', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='Status SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, help_text='Status SODAR UUID', unique=True + ), ), migrations.RenameModel( old_name='ProjectEvent', @@ -121,7 +281,11 @@ class Migration(migrations.Migration): migrations.AddField( model_name='timelineeventobjectref', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='Object reference SODAR UUID', null=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='Object reference SODAR UUID', + null=True, + ), ), migrations.RunPython( code=populate_object_ref_uuid, @@ -130,6 +294,10 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='timelineeventobjectref', name='sodar_uuid', - field=models.UUIDField(default=uuid.uuid4, help_text='Object reference SODAR UUID', unique=True), + field=models.UUIDField( + default=uuid.uuid4, + help_text='Object reference SODAR UUID', + unique=True, + ), ), ]