diff --git a/castellum/castellum_auth/migrations/0001_initial.py b/castellum/castellum_auth/migrations/0001_squashed_0002_initial.py similarity index 91% rename from castellum/castellum_auth/migrations/0001_initial.py rename to castellum/castellum_auth/migrations/0001_squashed_0002_initial.py index 5e097b03537e2d6942f0593510e2634e1135a211..c7b4e4058da48a3e36fade4b8c5f9162f6ee4736 100644 --- a/castellum/castellum_auth/migrations/0001_initial.py +++ b/castellum/castellum_auth/migrations/0001_squashed_0002_initial.py @@ -1,5 +1,6 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:26 +import castellum.castellum_auth.models import castellum.utils.fields import datetime import django.contrib.auth.models @@ -33,9 +34,10 @@ class Migration(migrations.Migration): ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), ('language', models.CharField(blank=True, choices=[('de', 'German'), ('en', 'English')], max_length=5, verbose_name='Language')), ('expiration_date', castellum.utils.fields.DateTimeField(blank=True, null=True, verbose_name='Expiration date')), - ('logout_timeout', models.DurationField(default=datetime.timedelta(0, 900), verbose_name='Time until automatic logout')), + ('logout_timeout', models.DurationField(default=datetime.timedelta(seconds=900), verbose_name='Time until automatic logout')), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')), ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')), + ('token', models.CharField(default=castellum.castellum_auth.models.generate_token, max_length=64, unique=True)), ], options={ 'ordering': ['username'], diff --git a/castellum/castellum_auth/migrations/0002_user_token.py b/castellum/castellum_auth/migrations/0002_user_token.py deleted file mode 100644 index bf163902df174d831cafe235a06a245f40ec56f9..0000000000000000000000000000000000000000 --- a/castellum/castellum_auth/migrations/0002_user_token.py +++ /dev/null @@ -1,32 +0,0 @@ -# See also https://stackoverflow.com/questions/42496655 - -import castellum.castellum_auth.models -from django.db import migrations, models - - -def set_tokens(apps, schema_editor): - User = apps.get_model('castellum_auth', 'User') - for user in User.objects.all(): - user.token = castellum.castellum_auth.models.generate_token() - user.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('castellum_auth', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='user', - name='token', - field=models.CharField(max_length=64, default='empty'), - ), - migrations.RunPython(set_tokens), - migrations.AlterField( - model_name='user', - name='token', - field=models.CharField(default=castellum.castellum_auth.models.generate_token, max_length=64, unique=True), - ), - ] diff --git a/castellum/contacts/migrations/0001_initial.py b/castellum/contacts/migrations/0001_squashed_0004_initial.py similarity index 91% rename from castellum/contacts/migrations/0001_initial.py rename to castellum/contacts/migrations/0001_squashed_0004_initial.py index 022d0267cfb56a2938d6bb14554620880517b9b7..da409c45ea55cbee1b2ac7b884b318f3feefc4b9 100644 --- a/castellum/contacts/migrations/0001_initial.py +++ b/castellum/contacts/migrations/0001_squashed_0004_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:26 import castellum.utils.fields from django.db import migrations, models @@ -13,30 +13,12 @@ class Migration(migrations.Migration): ] operations = [ - migrations.CreateModel( - name='Address', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('country', models.CharField(max_length=64, verbose_name='Country')), - ('city', models.CharField(max_length=128, verbose_name='City')), - ('zip_code', models.CharField(max_length=5, verbose_name='Zip code')), - ('street', models.CharField(max_length=128, verbose_name='Street')), - ('house_number', models.CharField(max_length=5, verbose_name='House number')), - ('additional_information', models.CharField(blank=True, max_length=32, verbose_name='Additional information')), - ], - options={ - 'verbose_name': 'Address', - 'verbose_name_plural': 'Addresses', - 'ordering': ['country', 'city', 'zip_code', 'street', 'house_number', 'additional_information'], - }, - ), migrations.CreateModel( name='Contact', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateField(auto_now_add=True, verbose_name='created at')), ('updated_at', models.DateField(auto_now=True, verbose_name='updated at')), - ('pseudonym', models.CharField(default=None, editable=False, max_length=64, unique=True)), ('first_name', models.CharField(max_length=64, verbose_name='First name')), ('first_name_phonetic', models.CharField(default=None, editable=False, max_length=128)), ('last_name', models.CharField(max_length=64, verbose_name='Last name')), @@ -48,8 +30,8 @@ class Migration(migrations.Migration): ('phone_number', castellum.utils.fields.PhoneNumberField(blank=True, max_length=32, region=None, verbose_name='Phone number')), ('phone_number_alternative', castellum.utils.fields.PhoneNumberField(blank=True, max_length=32, region=None, verbose_name='Phone number alternative')), ('preferred_contact_method', models.CharField(blank=True, choices=[('phone', 'phone'), ('email', 'email'), ('postal', 'postal')], max_length=16, verbose_name='Preferred contact method')), - ('address', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='contacts.Address', verbose_name='Address')), ('guardians', models.ManyToManyField(blank=True, related_name='guardian_of', to='contacts.Contact', verbose_name='Guardians')), + ('subject_id', models.PositiveIntegerField(default=None, editable=False, unique=True)), ], options={ 'verbose_name': 'Contact', @@ -57,4 +39,22 @@ class Migration(migrations.Migration): 'ordering': ['last_name', 'first_name'], }, ), + migrations.CreateModel( + name='Address', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('country', models.CharField(max_length=64, verbose_name='Country')), + ('city', models.CharField(max_length=128, verbose_name='City')), + ('zip_code', models.CharField(max_length=5, verbose_name='Zip code')), + ('street', models.CharField(max_length=128, verbose_name='Street')), + ('house_number', models.CharField(max_length=5, verbose_name='House number')), + ('additional_information', models.CharField(blank=True, max_length=32, verbose_name='Additional information')), + ('contact', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='contacts.Contact')), + ], + options={ + 'verbose_name': 'Address', + 'verbose_name_plural': 'Addresses', + 'ordering': ['country', 'city', 'zip_code', 'street', 'house_number', 'additional_information'], + }, + ), ] diff --git a/castellum/contacts/migrations/0002_contact_subject_id.py b/castellum/contacts/migrations/0002_contact_subject_id.py deleted file mode 100644 index a23fba285a53822235f6ff8f56ffa7d511f926b6..0000000000000000000000000000000000000000 --- a/castellum/contacts/migrations/0002_contact_subject_id.py +++ /dev/null @@ -1,38 +0,0 @@ -from django.conf import settings -from django.db import migrations, models - -from castellum.pseudonyms.helpers import get_subject - - -def migrate_value(apps, schema_editor): - Contact = apps.get_model('contacts', 'Contact') - for contact in Contact.objects.all(): - domain = settings.CASTELLUM_DOMAINS['contact']['key'] - subject = get_subject(domain, contact.pseudonym) - contact.subject_id = subject.pk - contact.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('contacts', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='contact', - name='subject_id', - field=models.IntegerField(default=None, editable=False, unique=True, null=True), - ), - migrations.RunPython(migrate_value), - migrations.AlterField( - model_name='contact', - name='subject_id', - field=models.IntegerField(default=None, editable=False, unique=True), - ), - migrations.RemoveField( - model_name='contact', - name='pseudonym', - ), - ] diff --git a/castellum/contacts/migrations/0003_subject_id_positive.py b/castellum/contacts/migrations/0003_subject_id_positive.py deleted file mode 100644 index d492e6175202256779f5b77f15249482510c73b2..0000000000000000000000000000000000000000 --- a/castellum/contacts/migrations/0003_subject_id_positive.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.4 on 2020-03-16 17:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('contacts', '0002_contact_subject_id'), - ] - - operations = [ - migrations.AlterField( - model_name='contact', - name='subject_id', - field=models.PositiveIntegerField(default=None, editable=False, unique=True), - ), - ] diff --git a/castellum/contacts/migrations/0004_refactor_contact_address.py b/castellum/contacts/migrations/0004_refactor_contact_address.py deleted file mode 100644 index 88d09a1a437b8209cbe560fd7ccf4887d9625e9d..0000000000000000000000000000000000000000 --- a/castellum/contacts/migrations/0004_refactor_contact_address.py +++ /dev/null @@ -1,35 +0,0 @@ -from django.db import migrations, models -import django.db.models.deletion - - -def migrate_data(apps, schema_editor): - Address = apps.get_model('contacts', 'Address') - for address in Address.objects.all(): - address.contact = address.contact_set.get() - address.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('contacts', '0003_subject_id_positive'), - ] - - operations = [ - migrations.AddField( - model_name='address', - name='contact', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='contacts.Contact', blank=True, null=True, related_name='+'), - preserve_default=False, - ), - migrations.RunPython(migrate_data), - migrations.AlterField( - model_name='address', - name='contact', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='contacts.Contact'), - ), - migrations.RemoveField( - model_name='contact', - name='address', - ), - ] diff --git a/castellum/geofilters/migrations/0001_initial.py b/castellum/geofilters/migrations/0001_initial.py index c4094e17c2e119745546029fb36be375cde205ab..3874286209e01a10dae935ce60509c1d0979ee7b 100644 --- a/castellum/geofilters/migrations/0001_initial.py +++ b/castellum/geofilters/migrations/0001_initial.py @@ -10,7 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('contacts', '0004_refactor_contact_address'), + ('contacts', '0001_squashed_0004_initial'), ] operations = [ diff --git a/castellum/pseudonyms/migrations/0001_initial.py b/castellum/pseudonyms/migrations/0001_squashed_0002_initial.py similarity index 86% rename from castellum/pseudonyms/migrations/0001_initial.py rename to castellum/pseudonyms/migrations/0001_squashed_0002_initial.py index b9cccd293a23eed3b45e90094a2eb17249e75cce..4f78f779e6f181f5774d61c65e25ff1d7563035b 100644 --- a/castellum/pseudonyms/migrations/0001_initial.py +++ b/castellum/pseudonyms/migrations/0001_squashed_0002_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:27 import castellum.utils from django.db import migrations, models @@ -10,7 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('subjects', '0001_initial'), + ('subjects', '0001_squashed_0016_initial'), ] operations = [ @@ -31,7 +31,7 @@ class Migration(migrations.Migration): ('subject', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='subjects.Subject')), ], options={ - 'unique_together': {('domain', 'pseudonym')}, + 'unique_together': {('domain', 'subject'), ('domain', 'pseudonym')}, }, ), ] diff --git a/castellum/pseudonyms/migrations/0002_pseudonym_unique_subject_domain.py b/castellum/pseudonyms/migrations/0002_pseudonym_unique_subject_domain.py deleted file mode 100644 index b56605a7ee4bd3a832d279d81233957bc0b5f4ef..0000000000000000000000000000000000000000 --- a/castellum/pseudonyms/migrations/0002_pseudonym_unique_subject_domain.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-16 14:53 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0008_rename_consent'), - ('pseudonyms', '0001_initial'), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='pseudonym', - unique_together={('domain', 'pseudonym'), ('domain', 'subject')}, - ), - ] diff --git a/castellum/recruitment/migrations/0001_initial.py b/castellum/recruitment/migrations/0001_squashed_0007_initial.py similarity index 71% rename from castellum/recruitment/migrations/0001_initial.py rename to castellum/recruitment/migrations/0001_squashed_0007_initial.py index 5b4d6fc7e29fdbaa319af15beb1eeffb86197812..8be9e276bd71be3bffe7e26837b6b37d188ff959 100644 --- a/castellum/recruitment/migrations/0001_initial.py +++ b/castellum/recruitment/migrations/0001_squashed_0007_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:27 import castellum.recruitment.models.attributesets import castellum.utils.fields @@ -6,6 +6,8 @@ import django.contrib.postgres.fields.jsonb import django.core.serializers.json import django.core.validators from django.db import migrations, models +import django.db.models.deletion +import parler.fields import parler.models @@ -14,6 +16,8 @@ class Migration(migrations.Migration): initial = True dependencies = [ + ('studies', '0001_squashed_0013_initial'), + ('subjects', '0001_squashed_0016_initial'), ] operations = [ @@ -31,57 +35,61 @@ class Migration(migrations.Migration): bases=(castellum.recruitment.models.attributesets.ImportMixin, parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='AttributeCategoryTranslation', + name='AttributeDescription', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('label', models.CharField(max_length=64)), + ('field_type', models.CharField(choices=[('CharField', 'CharField'), ('ChoiceField', 'ChoiceField'), ('MultipleChoiceField', 'MultipleChoiceField'), ('OrderedChoiceField', 'OrderedChoiceField'), ('IntegerField', 'IntegerField'), ('BooleanField', 'BooleanField'), ('DateField', 'DateField'), ('AgeField', 'AgeField')], max_length=64)), + ('privacy_level_read', models.PositiveSmallIntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2)])), + ('privacy_level_write', models.PositiveSmallIntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2)])), + ('order', models.IntegerField(default=0)), + ('statistics_rank', models.CharField(blank=True, choices=[('primary', 'primary'), ('secondary', 'secondary')], max_length=16, null=True, unique=True)), + ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='recruitment.AttributeCategory')), ], options={ - 'verbose_name': 'Attribute category Translation', - 'db_table': 'recruitment_attributecategory_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), + 'ordering': ['order'], }, - bases=(parler.models.TranslatedFieldsModelMixin, models.Model), + bases=(castellum.recruitment.models.attributesets.ImportMixin, parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='AttributeChoice', + name='ParticipationRequest', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('order', models.IntegerField(default=0)), + ('status', models.IntegerField(choices=[(0, 'not contacted'), (1, 'not reached'), (2, 'unsuitable'), (3, 'invited'), (4, 'follow-up scheduled'), (5, 'awaiting response')], default=0, verbose_name='Status of participation request')), + ('exclusion_criteria_checked', models.BooleanField(default=False, verbose_name='Subject may be suitable')), + ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study', verbose_name='Study')), + ('subject', models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), + ('followup_date', castellum.utils.fields.DateField(blank=True, null=True, verbose_name='Follow-up date')), + ('followup_time', models.TimeField(blank=True, null=True, verbose_name='Follow-up time')), ], options={ - 'ordering': ['order'], + 'verbose_name': 'Participation request', + 'verbose_name_plural': 'Participation requests', + 'permissions': (('view_participation_pseudonyms', 'Can view participation pseudonyms'), ('search_execution', 'Can search in execution')), + 'unique_together': {('study', 'subject')}, }, - bases=(castellum.recruitment.models.attributesets.ImportMixin, parler.models.TranslatableModelMixin, models.Model), ), migrations.CreateModel( - name='AttributeChoiceTranslation', + name='SubjectFilterGroup', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), - ('label', models.CharField(max_length=64)), + ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study')), ], - options={ - 'verbose_name': 'attribute choice Translation', - 'db_table': 'recruitment_attributechoice_translation', - 'db_tablespace': '', - 'managed': True, - 'default_permissions': (), - }, - bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.CreateModel( - name='AttributeDescription', + name='MailBatch', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Sent date')), + ('contacted_size', models.PositiveIntegerField()), + ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study', verbose_name='Study')), + ], + ), + migrations.CreateModel( + name='AttributeChoice', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('field_type', models.CharField(choices=[('CharField', 'CharField'), ('ChoiceField', 'ChoiceField'), ('MultipleChoiceField', 'MultipleChoiceField'), ('OrderedChoiceField', 'OrderedChoiceField'), ('IntegerField', 'IntegerField'), ('BooleanField', 'BooleanField'), ('DateField', 'DateField'), ('AgeField', 'AgeField')], max_length=64)), - ('privacy_level_read', models.PositiveSmallIntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2)])), - ('privacy_level_write', models.PositiveSmallIntegerField(default=0, validators=[django.core.validators.MaxValueValidator(2)])), ('order', models.IntegerField(default=0)), - ('statistics_rank', models.CharField(blank=True, choices=[('primary', 'primary'), ('secondary', 'secondary')], max_length=16, null=True, unique=True)), + ('description', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.AttributeDescription')), ], options={ 'ordering': ['order'], @@ -96,6 +104,7 @@ class Migration(migrations.Migration): ('label', models.CharField(max_length=64)), ('_filter_label', models.CharField(blank=True, default='', max_length=64)), ('help_text', models.TextField(blank=True, default='')), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeDescription')), ], options={ 'verbose_name': 'attribute description Translation', @@ -103,42 +112,59 @@ class Migration(migrations.Migration): 'db_tablespace': '', 'managed': True, 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.CreateModel( - name='AttributeSet', + name='AttributeChoiceTranslation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateField(auto_now_add=True, verbose_name='created at')), - ('updated_at', models.DateField(auto_now=True, verbose_name='updated at')), - ('data', django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder)), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('label', models.CharField(max_length=64)), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeChoice')), ], options={ - 'verbose_name': 'Attribute set', - 'verbose_name_plural': 'Attribute sets', + 'verbose_name': 'attribute choice Translation', + 'db_table': 'recruitment_attributechoice_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, }, + bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.CreateModel( - name='MailBatch', + name='AttributeCategoryTranslation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('datetime', models.DateTimeField(auto_now_add=True, verbose_name='Sent date')), - ('contacted_size', models.PositiveIntegerField()), + ('language_code', models.CharField(db_index=True, max_length=15, verbose_name='Language')), + ('label', models.CharField(max_length=64)), + ('master', parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeCategory')), ], + options={ + 'verbose_name': 'Attribute category Translation', + 'db_table': 'recruitment_attributecategory_translation', + 'db_tablespace': '', + 'managed': True, + 'default_permissions': (), + 'unique_together': {('language_code', 'master')}, + }, + bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), migrations.CreateModel( - name='ParticipationRequest', + name='AttributeSet', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('status', models.IntegerField(choices=[(0, 'not contacted'), (1, 'not reached'), (2, 'unsuitable'), (3, 'invited'), (4, 'follow-up scheduled'), (5, 'awaiting response')], default=0, verbose_name='Status of participation request')), - ('exclusion_criteria_checked', models.BooleanField(default=False, verbose_name='Subject may be suitable')), - ('appointment', castellum.utils.fields.DateTimeField(blank=True, null=True, verbose_name='Appointment')), + ('created_at', models.DateField(auto_now_add=True, verbose_name='created at')), + ('updated_at', models.DateField(auto_now=True, verbose_name='updated at')), + ('data', django.contrib.postgres.fields.jsonb.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder)), + ('subject', models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), + ('study_type_disinterest', models.ManyToManyField(blank=True, related_name='_attributeset_study_type_disinterest_+', to='studies.StudyType', verbose_name='Does not want to participate in the following study types:')), ], options={ - 'verbose_name': 'Participation request', - 'verbose_name_plural': 'Participation requests', - 'permissions': (('view_participation_pseudonyms', 'Can view participation pseudonyms'),), + 'verbose_name': 'Attribute set', + 'verbose_name_plural': 'Attribute sets', }, ), migrations.CreateModel( @@ -147,8 +173,10 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('status', models.IntegerField(choices=[(0, 'not contacted'), (1, 'not reached'), (2, 'unsuitable'), (3, 'invited'), (4, 'follow-up scheduled'), (5, 'awaiting response')], default=0)), ('exclusion_criteria_checked', models.BooleanField()), - ('appointment', castellum.utils.fields.DateTimeField(blank=True, null=True)), ('created_at', castellum.utils.fields.DateTimeField(auto_now_add=True)), + ('current', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='recruitment.ParticipationRequest')), + ('followup_date', castellum.utils.fields.DateField(blank=True, null=True)), + ('followup_time', models.TimeField(blank=True, null=True)), ], ), migrations.CreateModel( @@ -156,13 +184,9 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('operator', models.CharField(max_length=64)), - ('value', models.TextField(editable=False)), - ], - ), - migrations.CreateModel( - name='SubjectFilterGroup', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('description', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.AttributeDescription')), + ('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.SubjectFilterGroup')), + ('value', django.contrib.postgres.fields.jsonb.JSONField(default={})), ], ), ] diff --git a/castellum/recruitment/migrations/0002_auto_20191116_1743.py b/castellum/recruitment/migrations/0002_auto_20191116_1743.py deleted file mode 100644 index a27c6dec66634720e691dff0c30eed2bd4fb5ab2..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0002_auto_20191116_1743.py +++ /dev/null @@ -1,100 +0,0 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 - -from django.db import migrations, models -import django.db.models.deletion -import parler.fields - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ('subjects', '0001_initial'), - ('recruitment', '0001_initial'), - ('studies', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='subjectfiltergroup', - name='study', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study'), - ), - migrations.AddField( - model_name='subjectfilter', - name='description', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.AttributeDescription'), - ), - migrations.AddField( - model_name='subjectfilter', - name='group', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.SubjectFilterGroup'), - ), - migrations.AddField( - model_name='participationrequestrevision', - name='current', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='recruitment.ParticipationRequest'), - ), - migrations.AddField( - model_name='participationrequest', - name='study', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study', verbose_name='Study'), - ), - migrations.AddField( - model_name='participationrequest', - name='subject', - field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject'), - ), - migrations.AddField( - model_name='mailbatch', - name='study', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study', verbose_name='Study'), - ), - migrations.AddField( - model_name='attributeset', - name='subject', - field=models.OneToOneField(editable=False, on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject'), - ), - migrations.AddField( - model_name='attributedescriptiontranslation', - name='master', - field=parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeDescription'), - ), - migrations.AddField( - model_name='attributedescription', - name='category', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='recruitment.AttributeCategory'), - ), - migrations.AddField( - model_name='attributechoicetranslation', - name='master', - field=parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeChoice'), - ), - migrations.AddField( - model_name='attributechoice', - name='description', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='recruitment.AttributeDescription'), - ), - migrations.AddField( - model_name='attributecategorytranslation', - name='master', - field=parler.fields.TranslationsForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='recruitment.AttributeCategory'), - ), - migrations.AlterUniqueTogether( - name='participationrequest', - unique_together={('study', 'subject')}, - ), - migrations.AlterUniqueTogether( - name='attributedescriptiontranslation', - unique_together={('language_code', 'master')}, - ), - migrations.AlterUniqueTogether( - name='attributechoicetranslation', - unique_together={('language_code', 'master')}, - ), - migrations.AlterUniqueTogether( - name='attributecategorytranslation', - unique_together={('language_code', 'master')}, - ), - ] diff --git a/castellum/recruitment/migrations/0003_fullowup.py b/castellum/recruitment/migrations/0003_fullowup.py deleted file mode 100644 index d01ecf6824a2acdb6ebfdbb1521825b41c42bdb8..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0003_fullowup.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 2.2.7 on 2019-11-19 10:44 - -import castellum.utils.fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('recruitment', '0002_auto_20191116_1743'), - ] - - operations = [ - migrations.RenameField( - model_name='participationrequestrevision', - old_name='appointment', - new_name='followup', - ), - migrations.RenameField( - model_name='participationrequest', - old_name='appointment', - new_name='followup', - ), - migrations.AlterField( - model_name='participationrequest', - name='followup', - field=castellum.utils.fields.DateTimeField(blank=True, null=True, verbose_name='Follow-up'), - ), - ] diff --git a/castellum/recruitment/migrations/0004_attributeset_study_type_disinterest.py b/castellum/recruitment/migrations/0004_attributeset_study_type_disinterest.py deleted file mode 100644 index 7206874fbcd527dd0a23595af3dd1829242c4808..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0004_attributeset_study_type_disinterest.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 2.2.7 on 2019-11-20 13:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0001_initial'), - ('recruitment', '0003_fullowup'), - ] - - operations = [ - migrations.AddField( - model_name='attributeset', - name='study_type_disinterest', - field=models.ManyToManyField(blank=True, related_name='_attributeset_study_type_disinterest_+', to='studies.StudyType', verbose_name='Does not want to participate in the following study types:'), - ), - ] diff --git a/castellum/recruitment/migrations/0005_split_followup.py b/castellum/recruitment/migrations/0005_split_followup.py deleted file mode 100644 index 0a8bf9186f38a04d581910cde74babb1f29d0720..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0005_split_followup.py +++ /dev/null @@ -1,53 +0,0 @@ -import castellum.utils.fields -from django.db import migrations, models - - -def split_followup(model): - for obj in model.objects.filter(followup__isnull=False): - obj.followup_date = obj.followup.date() - obj.followup_time = obj.followup.time() - obj.save() - - -def migrate_values(apps, schema_editor): - split_followup(apps.get_model('recruitment', 'ParticipationRequest')) - split_followup(apps.get_model('recruitment', 'ParticipationRequestRevision')) - - -class Migration(migrations.Migration): - - dependencies = [ - ('recruitment', '0004_attributeset_study_type_disinterest'), - ] - - operations = [ - migrations.AddField( - model_name='participationrequest', - name='followup_date', - field=castellum.utils.fields.DateField(blank=True, null=True, verbose_name='Follow-up date'), - ), - migrations.AddField( - model_name='participationrequest', - name='followup_time', - field=models.TimeField(blank=True, null=True, verbose_name='Follow-up time'), - ), - migrations.AddField( - model_name='participationrequestrevision', - name='followup_date', - field=castellum.utils.fields.DateField(blank=True, null=True), - ), - migrations.AddField( - model_name='participationrequestrevision', - name='followup_time', - field=models.TimeField(blank=True, null=True), - ), - migrations.RunPython(migrate_values), - migrations.RemoveField( - model_name='participationrequest', - name='followup', - ), - migrations.RemoveField( - model_name='participationrequestrevision', - name='followup', - ), - ] diff --git a/castellum/recruitment/migrations/0006_subjectfilter_value_json.py b/castellum/recruitment/migrations/0006_subjectfilter_value_json.py deleted file mode 100644 index 31b47bbea4f1bc1b43487fd6c59529870227e236..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0006_subjectfilter_value_json.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.contrib.postgres.fields import JSONField -from django.db import migrations - - -def copy_value(apps, schema_editor): - SubjectFilter = apps.get_model('recruitment', 'SubjectFilter') - for f in SubjectFilter.objects.all(): - f.value = f.value_old - f.save() - - -class Migration(migrations.Migration): - dependencies = [ - ('recruitment', '0005_split_followup'), - ] - - operations = [ - migrations.RenameField( - model_name='subjectfilter', - old_name='value', - new_name='value_old', - ), - migrations.AddField( - model_name='subjectfilter', - name='value', - field=JSONField(default={}), - preserve_default=False, - ), - migrations.RunPython(copy_value), - migrations.RemoveField( - model_name='subjectfilter', - name='value_old', - ), - ] diff --git a/castellum/recruitment/migrations/0007_perm_search_execution.py b/castellum/recruitment/migrations/0007_perm_search_execution.py deleted file mode 100644 index d1e3cd66d5c9d4bed0bf3b59caecda11c236490e..0000000000000000000000000000000000000000 --- a/castellum/recruitment/migrations/0007_perm_search_execution.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.2 on 2020-02-04 09:15 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('recruitment', '0006_subjectfilter_value_json'), - ] - - operations = [ - migrations.AlterModelOptions( - name='participationrequest', - options={'permissions': (('view_participation_pseudonyms', 'Can view participation pseudonyms'), ('search_execution', 'Can search in execution')), 'verbose_name': 'Participation request', 'verbose_name_plural': 'Participation requests'}, - ), - ] diff --git a/castellum/recruitment/migrations/0008_appointment.py b/castellum/recruitment/migrations/0008_appointment.py index 45b5bc6c7b29371c6a7d46ce9d07092acd02c5f5..527d6d5ecb832ff142853787677d65b8cea141d6 100644 --- a/castellum/recruitment/migrations/0008_appointment.py +++ b/castellum/recruitment/migrations/0008_appointment.py @@ -8,8 +8,8 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('studies', '0007_studysession_name_resource'), - ('recruitment', '0007_perm_search_execution'), + ('studies', '0001_squashed_0013_initial'), + ('recruitment', '0001_squashed_0007_initial'), ] operations = [ diff --git a/castellum/recruitment/migrations/0009_rename_participation_request.py b/castellum/recruitment/migrations/0009_rename_participation_request.py index c227fb60038c9caf4d6dce1c87d65a741f383ee5..6c9ebfffcbb91147effa7d4a60bb6c2c15ac707d 100644 --- a/castellum/recruitment/migrations/0009_rename_participation_request.py +++ b/castellum/recruitment/migrations/0009_rename_participation_request.py @@ -8,8 +8,8 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('studies', '0013_geojson_validator'), - ('subjects', '0016_consentdocument_is_deprecated'), + ('studies', '0001_squashed_0013_initial'), + ('subjects', '0001_squashed_0016_initial'), ('recruitment', '0008_appointment'), ] diff --git a/castellum/recruitment/migrations/0010_rename_participant.py b/castellum/recruitment/migrations/0010_rename_participant.py index 513f68b910ea9ca1701bf676f394170d15681e23..e9603bc7a6b86a4a7c5537b8f255497449ba8dcd 100644 --- a/castellum/recruitment/migrations/0010_rename_participant.py +++ b/castellum/recruitment/migrations/0010_rename_participant.py @@ -7,7 +7,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('studies', '0013_geojson_validator'), + ('studies', '0001_squashed_0013_initial'), ('recruitment', '0009_rename_participation_request'), ] diff --git a/castellum/studies/migrations/0001_initial.py b/castellum/studies/migrations/0001_squashed_0013_initial.py similarity index 63% rename from castellum/studies/migrations/0001_initial.py rename to castellum/studies/migrations/0001_squashed_0013_initial.py index 822d09e6b1b4c77d0f8db913ae19b4c0e211869b..b1e7d7768ee6e34d5276675cbd406e73fc4b20c3 100644 --- a/castellum/studies/migrations/0001_initial.py +++ b/castellum/studies/migrations/0001_squashed_0013_initial.py @@ -1,6 +1,7 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:27 import castellum.utils.fields +import castellum.utils.forms from django.conf import settings from django.db import migrations, models import django.db.models.deletion @@ -58,22 +59,15 @@ class Migration(migrations.Migration): name='StudyType', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('exclusion_criteria', models.TextField(blank=True, verbose_name='Inclusion/exclusion criteria')), + ('exclusion_criteria', models.TextField(blank=True, verbose_name='Additional subject characteristics that should be verified during recruitment')), ('data_sensitivity', models.BooleanField(default=False, verbose_name='Contains sensitive data')), + ('export_key', models.CharField(blank=True, choices=[('Online', 'Online'), ('Behavioral lab', 'Behavioral lab'), ('MRI', 'MRI'), ('Simulation', 'Simulation'), ('EEG', 'EEG')], max_length=32, verbose_name='Export key')), ], options={ 'abstract': False, }, bases=(parler.models.TranslatableModelMixin, models.Model), ), - migrations.CreateModel( - name='StudySession', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('duration', models.PositiveIntegerField(verbose_name='Duration of a session in minutes')), - ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study')), - ], - ), migrations.CreateModel( name='StudyMembership', fields=[ @@ -91,11 +85,6 @@ class Migration(migrations.Migration): name='members', field=models.ManyToManyField(through='studies.StudyMembership', to=settings.AUTH_USER_MODEL), ), - migrations.AddField( - model_name='study', - name='study_type', - field=models.ManyToManyField(blank=True, to='studies.StudyType', verbose_name='Type of study'), - ), migrations.CreateModel( name='StudyTypeTranslation', fields=[ @@ -114,4 +103,61 @@ class Migration(migrations.Migration): }, bases=(parler.models.TranslatedFieldsModelMixin, models.Model), ), + migrations.AlterField( + model_name='study', + name='mail_body', + field=models.TextField(blank=True, help_text='Any "{firstname}" and "{lastname}"-tags included in the e-mail-body will automatically be replaced with the first and last name of the subject.', verbose_name='E-mail body'), + ), + migrations.AlterField( + model_name='study', + name='exclusion_criteria', + field=models.TextField(blank=True, verbose_name='Additional subject characteristics that should be verified during recruitment'), + ), + migrations.AddField( + model_name='study', + name='to_be_deleted_notified', + field=models.BooleanField(default=False), + ), + migrations.AlterField( + model_name='study', + name='min_subject_count', + field=models.PositiveIntegerField(default=0, verbose_name='Required number of subjects'), + ), + migrations.CreateModel( + name='Resource', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=128, verbose_name='Name')), + ], + ), + migrations.AddField( + model_name='study', + name='session_instructions', + field=models.TextField(blank=True, help_text='Please describe any requirements for carrying out the sessions listed below. For example, specify time intervals between sessions that need to be considered for booking appointments.', verbose_name='Session instructions'), + ), + migrations.CreateModel( + name='StudySession', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('duration', models.PositiveIntegerField(verbose_name='Duration of a session in minutes')), + ('study', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='studies.Study')), + ('name', models.CharField(default='session', max_length=128, verbose_name='Name')), + ('resource', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='studies.Resource', verbose_name='Resource')), + ('type', models.ManyToManyField(blank=True, to='studies.StudyType', verbose_name='Type')), + ], + ), + migrations.RemoveField( + model_name='study', + name='expense_allowance', + ), + migrations.AlterField( + model_name='study', + name='recruitment_text', + field=models.TextField(blank=True, help_text='This text will be used during recruitment dialogue. Thus, please describe the study from the perspective of recruiters and potential participants: What is it about? How long will it take? Are there any potential benefits or risks for participants? If applicable, also present the amount of expense allowance and related requirements.', verbose_name='Recruitment text'), + ), + migrations.AddField( + model_name='study', + name='geo_filter', + field=castellum.utils.fields.RestrictedFileField(blank=True, help_text='A GeoJSON file that contains only a single (multi)polygon. Only subjects who live inside this polygon will be considered for this study.', upload_to='studies/geofilters/', validators=[castellum.utils.forms.JsonFileValidator({'$defs': {'Feature': {'properties': {'geometry': {'oneOf': [{'$ref': '#/$defs/Polygon'}, {'$ref': '#/$defs/MultiPolygon'}]}, 'properties': {'oneOf': [{'type': 'null'}, {'type': 'object'}]}, 'type': {'enum': ['Feature'], 'type': 'string'}}, 'required': ['type', 'properties', 'geometry'], 'type': 'object'}, 'MultiPolygon': {'properties': {'coordinates': {'items': {'$ref': '#/$defs/MultiPolygon'}, 'type': 'array'}, 'type': {'enum': ['MultiPolygon'], 'type': 'string'}}, 'required': ['type', 'coordinates'], 'type': 'object'}, 'Polygon': {'properties': {'coordinates': {'$ref': '#/$defs/PolygonCoordinates'}, 'type': {'enum': ['Polygon'], 'type': 'string'}}, 'required': ['type', 'coordinates'], 'type': 'object'}, 'PolygonCoordinates': {'items': {'items': {'items': {'type': 'number'}, 'minItems': 2, 'type': 'array'}, 'minItems': 4, 'type': 'array'}, 'type': 'array'}}, '$schema': 'http://json-schema.org/draft-07/schema#'}, '#/$defs/Feature')], verbose_name='Geo filter file'), + ), ] diff --git a/castellum/studies/migrations/0002_studytype_export_key.py b/castellum/studies/migrations/0002_studytype_export_key.py deleted file mode 100644 index 0d02a2f5172f988d5f2b2470516f4452bf445db9..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0002_studytype_export_key.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.6 on 2019-11-19 11:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='studytype', - name='export_key', - field=models.CharField(blank=True, choices=[('Online', 'Online'), ('Behavioral lab', 'Behavioral lab'), ('MRI', 'MRI'), ('Simulation', 'Simulation'), ('EEG', 'EEG'), ('3rd party', '3rd party')], max_length=32, verbose_name='Export key'), - ), - ] diff --git a/castellum/studies/migrations/0003_auto_20200106_1502.py b/castellum/studies/migrations/0003_auto_20200106_1502.py deleted file mode 100644 index 0836d102712b9d85867d93d8043874b552f0b0d0..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0003_auto_20200106_1502.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 2.2.8 on 2020-01-06 14:02 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0002_studytype_export_key'), - ] - - operations = [ - migrations.AlterField( - model_name='study', - name='mail_body', - field=models.TextField(blank=True, help_text='Any "{firstname}" and "{lastname}"-tags included in the e-mail-body will automatically be replaced with the first and last name of the subject.', verbose_name='E-mail body'), - ), - ] diff --git a/castellum/studies/migrations/0004_study_exclusion_critera_verbose_name.py b/castellum/studies/migrations/0004_study_exclusion_critera_verbose_name.py deleted file mode 100644 index ae0e25c701775f57db3bd760ecf250b35b0145a3..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0004_study_exclusion_critera_verbose_name.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.2 on 2020-01-29 13:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0003_auto_20200106_1502'), - ] - - operations = [ - migrations.AlterField( - model_name='studytype', - name='exclusion_criteria', - field=models.TextField(blank=True, verbose_name='Additional subject characteristics that should be verified during recruitment'), - ), - migrations.AlterField( - model_name='study', - name='exclusion_criteria', - field=models.TextField(blank=True, verbose_name='Additional subject characteristics that should be verified during recruitment'), - ), - ] diff --git a/castellum/studies/migrations/0005_study_to_be_deleted_notified.py b/castellum/studies/migrations/0005_study_to_be_deleted_notified.py deleted file mode 100644 index 163a10423bf818f4b15374c4a5c233fbba492db7..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0005_study_to_be_deleted_notified.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.2 on 2020-02-18 17:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0004_study_exclusion_critera_verbose_name'), - ] - - operations = [ - migrations.AddField( - model_name='study', - name='to_be_deleted_notified', - field=models.BooleanField(default=False), - ), - ] diff --git a/castellum/studies/migrations/0006_study_min_subject_count_default.py b/castellum/studies/migrations/0006_study_min_subject_count_default.py deleted file mode 100644 index 1b5d40877c471263780e547e4a16b767152157d9..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0006_study_min_subject_count_default.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-01 14:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0005_study_to_be_deleted_notified'), - ] - - operations = [ - migrations.AlterField( - model_name='study', - name='min_subject_count', - field=models.PositiveIntegerField(default=0, verbose_name='Required number of subjects'), - ), - ] diff --git a/castellum/studies/migrations/0007_studysession_name_resource.py b/castellum/studies/migrations/0007_studysession_name_resource.py deleted file mode 100644 index 5bd43795ffac0f136d4b43f31c2cad10ae8702e9..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0007_studysession_name_resource.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated by Django 3.0.4 on 2020-03-18 17:44 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0006_study_min_subject_count_default'), - ] - - operations = [ - migrations.CreateModel( - name='Resource', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128, verbose_name='Name')), - ], - ), - migrations.AddField( - model_name='studysession', - name='name', - field=models.CharField(default='session', max_length=128, verbose_name='Name'), - preserve_default=False, - ), - migrations.AddField( - model_name='studysession', - name='resource', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='studies.Resource', verbose_name='Resource'), - ), - ] diff --git a/castellum/studies/migrations/0008_study_type_rm_3rd_party.py b/castellum/studies/migrations/0008_study_type_rm_3rd_party.py deleted file mode 100644 index ab52d4f006ad20d4b68fbef6e86cb0ff2b8d4e2a..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0008_study_type_rm_3rd_party.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.5 on 2020-04-29 15:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0007_studysession_name_resource'), - ] - - operations = [ - migrations.AlterField( - model_name='studytype', - name='export_key', - field=models.CharField(blank=True, choices=[('Online', 'Online'), ('Behavioral lab', 'Behavioral lab'), ('MRI', 'MRI'), ('Simulation', 'Simulation'), ('EEG', 'EEG')], max_length=32, verbose_name='Export key'), - ), - ] diff --git a/castellum/studies/migrations/0009_study_session_instructions.py b/castellum/studies/migrations/0009_study_session_instructions.py deleted file mode 100644 index 988992618e7bfd12240161598112bf031937d829..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0009_study_session_instructions.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-05 09:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0008_study_type_rm_3rd_party'), - ] - - operations = [ - migrations.AddField( - model_name='study', - name='session_instructions', - field=models.TextField(blank=True, help_text='Please describe any requirements for carrying out the sessions listed below. For example, specify time intervals between sessions that need to be considered for booking appointments.', verbose_name='Session instructions'), - ), - ] diff --git a/castellum/studies/migrations/0010_studysession_type.py b/castellum/studies/migrations/0010_studysession_type.py deleted file mode 100644 index f6a91ccedfd96c71f23feba2cb14cfa72c48f284..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0010_studysession_type.py +++ /dev/null @@ -1,34 +0,0 @@ -from django.db import migrations, models - - -def migrate_data(apps, schema_editor): - Study = apps.get_model('studies', 'Study') - StudySession = apps.get_model('studies', 'StudySession') - - for study in Study.objects.all(): - if not study.study_type.exists(): - continue - session = study.studysession_set.first() - if not session: - session = study.studysession_set.create(name='session', duration=0) - session.type.set(study.study_type.all()) - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0009_study_session_instructions') - ] - - operations = [ - migrations.AddField( - model_name='studysession', - name='type', - field=models.ManyToManyField(blank=True, to='studies.StudyType', verbose_name='Type'), - ), - migrations.RunPython(migrate_data), - migrations.RemoveField( - model_name='study', - name='study_type', - ), - ] diff --git a/castellum/studies/migrations/0011_rm_study_expense_allowance.py b/castellum/studies/migrations/0011_rm_study_expense_allowance.py deleted file mode 100644 index bfa4691a0743089683fea37c7a0275115c7c048e..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0011_rm_study_expense_allowance.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 3.0.5 on 2020-05-06 14:00 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0010_studysession_type'), - ] - - operations = [ - migrations.RemoveField( - model_name='study', - name='expense_allowance', - ), - migrations.AlterField( - model_name='study', - name='recruitment_text', - field=models.TextField(blank=True, help_text='This text will be used during recruitment dialogue. Thus, please describe the study from the perspective of recruiters and potential participants: What is it about? How long will it take? Are there any potential benefits or risks for participants? If applicable, also present the amount of expense allowance and related requirements.', verbose_name='Recruitment text'), - ), - ] diff --git a/castellum/studies/migrations/0012_study_geo_filter.py b/castellum/studies/migrations/0012_study_geo_filter.py deleted file mode 100644 index a995d7aa14494c25b1813e88da4034acd32696f8..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0012_study_geo_filter.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.6 on 2020-06-15 10:18 - -import castellum.utils.fields -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0011_rm_study_expense_allowance'), - ] - - operations = [ - migrations.AddField( - model_name='study', - name='geo_filter', - field=castellum.utils.fields.RestrictedFileField(blank=True, help_text='A GeoJSON file that contains only a single (multi)polygon. Only subjects who live inside this polygon will be considered for this study.', upload_to='studies/geofilters/', verbose_name='Geo filter file'), - ), - ] diff --git a/castellum/studies/migrations/0013_geojson_validator.py b/castellum/studies/migrations/0013_geojson_validator.py deleted file mode 100644 index c8e2605dccf50059e7b2eb20dd9f59946d468f0c..0000000000000000000000000000000000000000 --- a/castellum/studies/migrations/0013_geojson_validator.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 3.0.6 on 2020-06-22 13:41 - -import castellum.utils.fields -import castellum.utils.forms -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('studies', '0012_study_geo_filter'), - ] - - operations = [ - migrations.AlterField( - model_name='study', - name='geo_filter', - field=castellum.utils.fields.RestrictedFileField(blank=True, help_text='A GeoJSON file that contains only a single (multi)polygon. Only subjects who live inside this polygon will be considered for this study.', upload_to='studies/geofilters/', validators=[castellum.utils.forms.JsonFileValidator({'$defs': {'Feature': {'properties': {'geometry': {'oneOf': [{'$ref': '#/$defs/Polygon'}, {'$ref': '#/$defs/MultiPolygon'}]}, 'properties': {'oneOf': [{'type': 'null'}, {'type': 'object'}]}, 'type': {'enum': ['Feature'], 'type': 'string'}}, 'required': ['type', 'properties', 'geometry'], 'type': 'object'}, 'MultiPolygon': {'properties': {'coordinates': {'items': {'$ref': '#/$defs/MultiPolygon'}, 'type': 'array'}, 'type': {'enum': ['MultiPolygon'], 'type': 'string'}}, 'required': ['type', 'coordinates'], 'type': 'object'}, 'Polygon': {'properties': {'coordinates': {'$ref': '#/$defs/PolygonCoordinates'}, 'type': {'enum': ['Polygon'], 'type': 'string'}}, 'required': ['type', 'coordinates'], 'type': 'object'}, 'PolygonCoordinates': {'items': {'items': {'items': {'type': 'number'}, 'minItems': 2, 'type': 'array'}, 'minItems': 4, 'type': 'array'}, 'type': 'array'}}, '$schema': 'http://json-schema.org/draft-07/schema#'}, '#/$defs/Feature')], verbose_name='Geo filter file'), - ), - ] diff --git a/castellum/studies/migrations/0014_studytypeeventfeed.py b/castellum/studies/migrations/0014_studytypeeventfeed.py index 5cdeaed55108ea89153240ed0753159616c3e995..0082f42563309f5a79bcfe5bfb9bb638da1b0bfd 100644 --- a/castellum/studies/migrations/0014_studytypeeventfeed.py +++ b/castellum/studies/migrations/0014_studytypeeventfeed.py @@ -7,7 +7,7 @@ import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ - ('studies', '0013_geojson_validator'), + ('studies', '0001_squashed_0013_initial'), ] operations = [ diff --git a/castellum/subjects/migrations/0001_initial.py b/castellum/subjects/migrations/0001_squashed_0016_initial.py similarity index 63% rename from castellum/subjects/migrations/0001_initial.py rename to castellum/subjects/migrations/0001_squashed_0016_initial.py index 355384ffe61e65ad81f10c1255524f0764229dc8..aa443945c6c5afe00ab36e180414ef4dd464ea5e 100644 --- a/castellum/subjects/migrations/0001_initial.py +++ b/castellum/subjects/migrations/0001_squashed_0016_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.6 on 2019-11-16 16:43 +# Generated by Django 3.0.8 on 2020-09-01 09:27 import castellum.utils.fields from django.db import migrations, models @@ -13,18 +13,6 @@ class Migration(migrations.Migration): ] operations = [ - migrations.CreateModel( - name='Consent', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), - ('info', models.CharField(max_length=128, verbose_name='Info')), - ('file', castellum.utils.fields.RestrictedFileField(upload_to='consent/', verbose_name='File')), - ], - options={ - 'get_latest_by': 'created_at', - }, - ), migrations.CreateModel( name='Subject', fields=[ @@ -86,19 +74,72 @@ class Migration(migrations.Migration): name='availability_wednesday', field=models.ManyToManyField(blank=True, related_name='_subject_availability_wednesday_+', to='subjects.TimeSlot', verbose_name='Wednesday'), ), + migrations.AddField( + model_name='subject', + name='to_be_deleted_notified', + field=models.BooleanField(default=False), + ), + migrations.RemoveField( + model_name='subject', + name='no_recruitment', + ), + migrations.AlterField( + model_name='subject', + name='to_be_deleted', + field=models.DateTimeField(blank=True, help_text='All data about this subject should be deleted or fully anonymized. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR deletion.', null=True, verbose_name='To be deleted'), + ), + migrations.AlterField( + model_name='subject', + name='to_be_deleted', + field=models.DateField(blank=True, help_text='All data about this subject should be deleted or fully anonymized. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR deletion.', null=True, verbose_name='To be deleted'), + ), + migrations.AddField( + model_name='subject', + name='export_requested', + field=models.DateField(blank=True, help_text='The subject wants to receive an export of all data we have stored about them. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR export.', null=True, verbose_name='Export requested'), + ), migrations.CreateModel( - name='ConsentConfirmation', + name='ExportAnswer', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateField(auto_now_add=True, verbose_name='Created at')), + ('created_by', models.CharField(max_length=150, verbose_name='Created by')), + ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), + ], + options={ + 'verbose_name': 'Export answer', + }, + ), + migrations.AddField( + model_name='subject', + name='source', + field=models.CharField(blank=True, max_length=128, verbose_name='Data source'), + ), + migrations.CreateModel( + name='Consent', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), - ('type', models.CharField(choices=[('online', 'Online form'), ('paper', 'Pen & Paper'), ('phone', 'Telephone')], max_length=64, verbose_name='Type')), ('status', models.CharField(choices=[('waiting', 'Waiting for confirmation'), ('confirmed', 'Confirmed')], max_length=64, verbose_name='Status')), - ('revision', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.Consent')), - ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.Consent')), + ('subject', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), ], options={ - 'verbose_name': 'Consent confirmation', - 'get_latest_by': 'revision__created_at', + 'verbose_name': 'Consent', + 'get_latest_by': 'document__created_at', + }, + ), + migrations.CreateModel( + name='ConsentDocument', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), + ('file', castellum.utils.fields.RestrictedFileField(blank=True, upload_to='consent/', verbose_name='File')), + ('is_valid', models.BooleanField(default=True, verbose_name='Is valid')), + ('is_deprecated', models.BooleanField(default=False, verbose_name='Is deprecated')), + ], + options={ + 'get_latest_by': 'created_at', }, ), ] diff --git a/castellum/subjects/migrations/0002_subject_to_be_deleted_notified.py b/castellum/subjects/migrations/0002_subject_to_be_deleted_notified.py deleted file mode 100644 index db99b5b0735eaa89b677f90a1bab61fc5d011f56..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0002_subject_to_be_deleted_notified.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.2 on 2020-02-18 14:56 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='subject', - name='to_be_deleted_notified', - field=models.BooleanField(default=False), - ), - ] diff --git a/castellum/subjects/migrations/0003_subject_to_be_deleted_help_texts.py b/castellum/subjects/migrations/0003_subject_to_be_deleted_help_texts.py deleted file mode 100644 index c8e0e8a3fd0593b27f1e8b909f6cc5260b830672..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0003_subject_to_be_deleted_help_texts.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-24 12:48 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0002_subject_to_be_deleted_notified'), - ] - - operations = [ - migrations.AlterField( - model_name='subject', - name='no_recruitment', - field=models.BooleanField(default=False, help_text='This subject will not be taken into account for future recruitment, but the existing data is not deleted. This option should be used when a subject withdraws (GDPR) consent for recruitment.', verbose_name='Do not contact for recruitment'), - ), - migrations.AlterField( - model_name='subject', - name='to_be_deleted', - field=models.DateTimeField(blank=True, help_text='All data about this subject should be deleted or fully anonymized. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR deletion.', null=True, verbose_name='To be deleted'), - ), - ] diff --git a/castellum/subjects/migrations/0004_subject_to_be_deleted_date.py b/castellum/subjects/migrations/0004_subject_to_be_deleted_date.py deleted file mode 100644 index 6f0b886c76bdfd9b2ce44ad3db10d155bd2b032b..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0004_subject_to_be_deleted_date.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 15:02 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0003_subject_to_be_deleted_help_texts'), - ] - - operations = [ - migrations.AlterField( - model_name='subject', - name='to_be_deleted', - field=models.DateField(blank=True, help_text='All data about this subject should be deleted or fully anonymized. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR deletion.', null=True, verbose_name='To be deleted'), - ), - ] diff --git a/castellum/subjects/migrations/0005_subject_export_requested.py b/castellum/subjects/migrations/0005_subject_export_requested.py deleted file mode 100644 index cca2643c70eb237675e8e12d05ef3ab777e5ceb0..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0005_subject_export_requested.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 15:20 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0004_subject_to_be_deleted_date'), - ] - - operations = [ - migrations.AddField( - model_name='subject', - name='export_requested', - field=models.DateField(blank=True, help_text='The subject wants to receive an export of all data we have stored about them. This includes all data in Castellum and all data collected in studies. This option should be used when a subject requests GDPR export.', null=True, verbose_name='Export requested'), - ), - ] diff --git a/castellum/subjects/migrations/0006_exportanswer.py b/castellum/subjects/migrations/0006_exportanswer.py deleted file mode 100644 index 0f20748e4316782fadc41c035f7019770ce691b6..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0006_exportanswer.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.0.3 on 2020-02-26 16:38 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0005_subject_export_requested'), - ] - - operations = [ - migrations.CreateModel( - name='ExportAnswer', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created_at', models.DateField(auto_now_add=True, verbose_name='Created at')), - ('created_by', models.CharField(max_length=150, verbose_name='Created by')), - ('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject')), - ], - options={ - 'verbose_name': 'Export answer', - }, - ), - ] diff --git a/castellum/subjects/migrations/0007_consent_is_current.py b/castellum/subjects/migrations/0007_consent_is_current.py deleted file mode 100644 index 14f8044524d303be2dd08204a3f302e4dcc69554..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0007_consent_is_current.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-04 09:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0006_exportanswer'), - ] - - operations = [ - migrations.AddField( - model_name='consent', - name='is_current', - field=models.BooleanField(default=True, verbose_name='Is current'), - ), - ] diff --git a/castellum/subjects/migrations/0008_rename_consent.py b/castellum/subjects/migrations/0008_rename_consent.py deleted file mode 100644 index a3dfc2c3a0ce0707ab145fdb64baef1a951b77f5..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0008_rename_consent.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 10:52 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0007_consent_is_current'), - ] - - operations = [ - migrations.RenameModel( - old_name='Consent', - new_name='ConsentDocument', - ), - migrations.AlterModelOptions( - name='consentconfirmation', - options={'get_latest_by': 'document__created_at', 'verbose_name': 'Consent confirmation'}, - ), - migrations.RenameField( - model_name='consentconfirmation', - old_name='revision', - new_name='document', - ), - migrations.RenameModel( - old_name='ConsentConfirmation', - new_name='Consent', - ), - migrations.AlterModelOptions( - name='consent', - options={'get_latest_by': 'document__created_at', 'verbose_name': 'Consent'}, - ), - ] diff --git a/castellum/subjects/migrations/0009_subject_source.py b/castellum/subjects/migrations/0009_subject_source.py deleted file mode 100644 index e49339b229c9d17d89c28c737301553364c80ed8..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0009_subject_source.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.3 on 2020-03-10 11:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0008_rename_consent'), - ] - - operations = [ - migrations.AddField( - model_name='subject', - name='source', - field=models.CharField(blank=True, max_length=128, verbose_name='Data source'), - ), - ] diff --git a/castellum/subjects/migrations/0010_remove_consent_type.py b/castellum/subjects/migrations/0010_remove_consent_type.py deleted file mode 100644 index 66fcc3b1e608625c1effc7c689e847c6faf25eb4..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0010_remove_consent_type.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.4 on 2020-03-30 14:38 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0009_subject_source'), - ] - - operations = [ - migrations.RemoveField( - model_name='consent', - name='type', - ), - ] diff --git a/castellum/subjects/migrations/0011_remove_consentdocument_info.py b/castellum/subjects/migrations/0011_remove_consentdocument_info.py deleted file mode 100644 index d1f93b072a56385cb268cdb882343594b910d82a..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0011_remove_consentdocument_info.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-01 15:32 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0010_remove_consent_type'), - ] - - operations = [ - migrations.RemoveField( - model_name='consentdocument', - name='info', - ), - ] diff --git a/castellum/subjects/migrations/0012_consentdocument_file_optional.py b/castellum/subjects/migrations/0012_consentdocument_file_optional.py deleted file mode 100644 index 7a536d64c66f31d12c6425540c255f04ff2997fc..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0012_consentdocument_file_optional.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-08 13:10 - -import castellum.utils.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0011_remove_consentdocument_info'), - ] - - operations = [ - migrations.AlterField( - model_name='consentdocument', - name='file', - field=castellum.utils.fields.RestrictedFileField(blank=True, upload_to='consent/', verbose_name='File'), - ), - ] diff --git a/castellum/subjects/migrations/0013_rename_consentdocument_is_valid.py b/castellum/subjects/migrations/0013_rename_consentdocument_is_valid.py deleted file mode 100644 index f40234d4a164a97116b78bd72d74e52d5a7302e1..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0013_rename_consentdocument_is_valid.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-08 13:10 - -import castellum.utils.fields -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0012_consentdocument_file_optional'), - ] - - operations = [ - migrations.RenameField( - model_name='consentdocument', - old_name='is_current', - new_name='is_valid', - ), - migrations.AlterField( - model_name='consentdocument', - name='is_valid', - field=models.BooleanField(default=True, verbose_name='Is valid'), - ), - ] diff --git a/castellum/subjects/migrations/0014_remove_subject_no_recruitment.py b/castellum/subjects/migrations/0014_remove_subject_no_recruitment.py deleted file mode 100644 index 3491508a327788f8f46e6347651c03ecc9a23a47..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0014_remove_subject_no_recruitment.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-15 12:56 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0013_rename_consentdocument_is_valid'), - ] - - operations = [ - migrations.RemoveField( - model_name='subject', - name='no_recruitment', - ), - ] diff --git a/castellum/subjects/migrations/0015_subject_consent_onetoonefield.py b/castellum/subjects/migrations/0015_subject_consent_onetoonefield.py deleted file mode 100644 index 830f03d1f1d664357bd5025fac43fc78067436b5..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0015_subject_consent_onetoonefield.py +++ /dev/null @@ -1,32 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-15 13:44 - -from django.db import migrations, models -import django.db.models.deletion - - -def delete_surplus_consents(apps, schema_editor): - Consent = apps.get_model('subjects', 'Consent') - Subject = apps.get_model('subjects', 'Subject') - - for subject in Subject.objects.all(): - try: - consent = subject.consent_set.latest() - subject.consent_set.exclude(pk=consent.pk).delete() - except Consent.DoesNotExist: - pass - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0014_remove_subject_no_recruitment'), - ] - - operations = [ - migrations.RunPython(delete_surplus_consents), - migrations.AlterField( - model_name='consent', - name='subject', - field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='subjects.Subject'), - ), - ] diff --git a/castellum/subjects/migrations/0016_consentdocument_is_deprecated.py b/castellum/subjects/migrations/0016_consentdocument_is_deprecated.py deleted file mode 100644 index 95e17c881e23a6011237ebc193a0e488cb671834..0000000000000000000000000000000000000000 --- a/castellum/subjects/migrations/0016_consentdocument_is_deprecated.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.0.4 on 2020-04-21 09:07 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('subjects', '0015_subject_consent_onetoonefield'), - ] - - operations = [ - migrations.AddField( - model_name='consentdocument', - name='is_deprecated', - field=models.BooleanField(default=False, verbose_name='Is deprecated'), - ), - ] diff --git a/castellum/subjects/migrations/0017_refactor_permissions.py b/castellum/subjects/migrations/0017_refactor_permissions.py index ce2097dcaec074632d9c906b00abbcd390ba6de3..daa29863c4c3add8b43c38240ff71765de38b9f9 100644 --- a/castellum/subjects/migrations/0017_refactor_permissions.py +++ b/castellum/subjects/migrations/0017_refactor_permissions.py @@ -6,7 +6,7 @@ from django.db import migrations class Migration(migrations.Migration): dependencies = [ - ('subjects', '0016_consentdocument_is_deprecated'), + ('subjects', '0001_squashed_0016_initial'), ] operations = [