From 1e3da04336b9095e4497d098ea19c3178bc74cf6 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 7 Oct 2020 19:09:30 +0200 Subject: Refactoring of models. Document container - declare only id --- ishtar_common/migrations/0201_squashed.py | 6 +- .../migrations/0204_auto_20200514_1124.py | 27 ---- .../migrations/0204_auto_20201007_1630.py | 150 +++++++++++++++++++++ .../migrations/0205_auto_20200527_1500.py | 110 --------------- 4 files changed, 155 insertions(+), 138 deletions(-) delete mode 100644 ishtar_common/migrations/0204_auto_20200514_1124.py create mode 100644 ishtar_common/migrations/0204_auto_20201007_1630.py delete mode 100644 ishtar_common/migrations/0205_auto_20200527_1500.py (limited to 'ishtar_common/migrations') diff --git a/ishtar_common/migrations/0201_squashed.py b/ishtar_common/migrations/0201_squashed.py index d0710636e..d7b65626a 100644 --- a/ishtar_common/migrations/0201_squashed.py +++ b/ishtar_common/migrations/0201_squashed.py @@ -203,7 +203,11 @@ class Migration(migrations.Migration): 'ordering': ('title',), 'permissions': (('view_document', 'Peut voir tous les Documents'), ('view_own_document', 'Peut voir ses propres Documents'), ('add_own_document', 'Peut ajouter son propre Document'), ('change_own_document', 'Peut modifier ses propres Documents'), ('delete_own_document', 'Peut supprimer ses propres Documents')), }, - bases=(ishtar_common.models.StatisticItem, ishtar_common.models.TemplateItem, ishtar_common.models.OwnPerms, models.Model, ishtar_common.models.CachedGen, ishtar_common.models.FixAssociated, ishtar_common.models.CascasdeUpdate, ishtar_common.models.ImageContainerModel, ishtar_common.models.ValueGetter, ishtar_common.models.MainItem), + bases=(ishtar_common.models.StatisticItem, + ishtar_common.models.TemplateItem, + ishtar_common.models.OwnPerms, models.Model, + ishtar_common.models.CachedGen, + ishtar_common.models.FixAssociated, ishtar_common.models.CascasdeUpdate, ishtar_common.models.ImageContainerModel, ishtar_common.models.ValueGetter, ishtar_common.models.MainItem), ), migrations.CreateModel( name='DocumentTemplate', diff --git a/ishtar_common/migrations/0204_auto_20200514_1124.py b/ishtar_common/migrations/0204_auto_20200514_1124.py deleted file mode 100644 index 4eea40bf3..000000000 --- a/ishtar_common/migrations/0204_auto_20200514_1124.py +++ /dev/null @@ -1,27 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.27 on 2020-05-14 11:24 -from __future__ import unicode_literals - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('archaeological_warehouse', '0103_auto_container_views'), - ('ishtar_common', '0203_auto_20200407_1142'), - ] - - operations = [ - migrations.AddField( - model_name='document', - name='container', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contained_documents', to='archaeological_warehouse.Container', verbose_name='Container'), - ), - migrations.AddField( - model_name='document', - name='container_ref', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='contained_documents_ref', to='archaeological_warehouse.Container', verbose_name='Reference container'), - ), - ] diff --git a/ishtar_common/migrations/0204_auto_20201007_1630.py b/ishtar_common/migrations/0204_auto_20201007_1630.py new file mode 100644 index 000000000..9b5ab0876 --- /dev/null +++ b/ishtar_common/migrations/0204_auto_20201007_1630.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.27 on 2020-10-07 16:30 +from __future__ import unicode_literals + +import django.core.validators +from django.db import migrations, models +import django.db.models.deletion +import ishtar_common.models_common +import re + + +class Migration(migrations.Migration): + + dependencies = [ + ('ishtar_common', '0203_auto_20200407_1142'), + ] + + operations = [ + migrations.CreateModel( + name='DocumentTag', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z', 32), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ], + options={ + 'verbose_name': 'Document tag', + 'verbose_name_plural': 'Document tags', + 'ordering': ('label',), + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.CreateModel( + name='Language', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('label', models.TextField(verbose_name='Label')), + ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z', 32), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), + ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')), + ('available', models.BooleanField(default=True, verbose_name='Available')), + ('iso_code', models.CharField(blank=True, max_length=2, null=True, verbose_name='ISO code')), + ], + options={ + 'verbose_name': 'Language', + 'verbose_name_plural': 'Languages', + }, + bases=(ishtar_common.models_common.Cached, models.Model), + ), + migrations.AlterModelOptions( + name='sourcetype', + options={'ordering': ['label'], 'verbose_name': 'Document type', 'verbose_name_plural': 'Document types'}, + ), + migrations.AddField( + model_name='document', + name='container_id', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Container ID'), + ), + migrations.AddField( + model_name='document', + name='container_ref_id', + field=models.PositiveIntegerField(blank=True, null=True, verbose_name='Container ID'), + ), + migrations.AddField( + model_name='document', + name='isbn', + field=models.CharField(blank=True, max_length=13, null=True, verbose_name='ISBN'), + ), + migrations.AddField( + model_name='document', + name='issn', + field=models.CharField(blank=True, max_length=8, null=True, verbose_name='ISSN'), + ), + migrations.AddField( + model_name='document', + name='publisher', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='publish', to='ishtar_common.Organization', verbose_name='Publisher'), + ), + migrations.AddField( + model_name='document', + name='source', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Document', verbose_name='Source'), + ), + migrations.AddField( + model_name='document', + name='source_free_input', + field=models.CharField(blank=True, max_length=500, null=True, verbose_name='Source - free input'), + ), + migrations.AddField( + model_name='sourcetype', + name='coins_genre', + field=models.CharField(blank=True, max_length=100, verbose_name='COInS export - genre'), + ), + migrations.AddField( + model_name='sourcetype', + name='coins_type', + field=models.CharField(default='document', max_length=100, verbose_name='COInS export - type'), + ), + migrations.AddField( + model_name='sourcetype', + name='is_localized', + field=models.BooleanField(default=False, help_text='Setting a language for this type of document is relevant', verbose_name='Is localized'), + ), + migrations.AlterField( + model_name='document', + name='format_type', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='ishtar_common.Format', verbose_name='Medium'), + ), + migrations.AlterField( + model_name='importercolumn', + name='regexp_pre_filter', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='columns', to='ishtar_common.Regexp'), + ), + migrations.AlterField( + model_name='importercolumn', + name='value_format', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='columns', to='ishtar_common.ValueFormater'), + ), + migrations.AlterField( + model_name='importertype', + name='associated_models', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='importer_type_associated', to='ishtar_common.ImporterModel', verbose_name='Associated model'), + ), + migrations.AlterField( + model_name='importertype', + name='created_models', + field=models.ManyToManyField(blank=True, help_text='Leave blank for no restrictions', related_name='importer_type_created', to='ishtar_common.ImporterModel', verbose_name='Models that can accept new items'), + ), + migrations.AlterField( + model_name='importtarget', + name='formater_type', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='targets', to='ishtar_common.FormaterType'), + ), + migrations.AddField( + model_name='document', + name='language', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Language', verbose_name='Language'), + ), + migrations.AddField( + model_name='document', + name='tags', + field=models.ManyToManyField(blank=True, to='ishtar_common.DocumentTag', verbose_name='Tags'), + ), + migrations.AddField( + model_name='ishtarsiteprofile', + name='default_language', + field=models.ForeignKey(blank=True, help_text='If set, by default the selected language will be set for localized documents.', null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Language', verbose_name='Default language for documentation'), + ), + ] diff --git a/ishtar_common/migrations/0205_auto_20200527_1500.py b/ishtar_common/migrations/0205_auto_20200527_1500.py deleted file mode 100644 index deed0ad90..000000000 --- a/ishtar_common/migrations/0205_auto_20200527_1500.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- -# Generated by Django 1.11.27 on 2020-05-27 15:00 -from __future__ import unicode_literals - -import django.core.validators -from django.db import migrations, models -import django.db.models.deletion -import ishtar_common.models -import re - - -class Migration(migrations.Migration): - - dependencies = [ - ('ishtar_common', '0204_auto_20200514_1124'), - ] - - operations = [ - migrations.CreateModel( - name='DocumentTag', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.TextField(verbose_name='Label')), - ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z', 32), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), - ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')), - ('available', models.BooleanField(default=True, verbose_name='Available')), - ], - options={ - 'verbose_name': 'Document tag', - 'verbose_name_plural': 'Document tags', - 'ordering': ('label',), - }, - bases=(ishtar_common.models.Cached, models.Model), - ), - migrations.CreateModel( - name='Language', - fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('label', models.TextField(verbose_name='Label')), - ('txt_idx', models.TextField(help_text='The slug is the standardized version of the name. It contains only lowercase letters, numbers and hyphens. Each slug must be unique.', unique=True, validators=[django.core.validators.RegexValidator(re.compile('^[-a-zA-Z0-9_]+\\Z', 32), "Enter a valid 'slug' consisting of letters, numbers, underscores or hyphens.", 'invalid')], verbose_name='Textual ID')), - ('comment', models.TextField(blank=True, null=True, verbose_name='Comment')), - ('available', models.BooleanField(default=True, verbose_name='Available')), - ('iso_code', models.CharField(blank=True, max_length=2, null=True, verbose_name='ISO code')), - ], - options={ - 'verbose_name': 'Language', - 'verbose_name_plural': 'Languages', - }, - bases=(ishtar_common.models.Cached, models.Model), - ), - migrations.AlterModelOptions( - name='sourcetype', - options={'ordering': ['label'], 'verbose_name': 'Document type', 'verbose_name_plural': 'Document types'}, - ), - migrations.AddField( - model_name='document', - name='isbn', - field=models.CharField(blank=True, max_length=13, null=True, verbose_name='ISBN'), - ), - migrations.AddField( - model_name='document', - name='issn', - field=models.CharField(blank=True, max_length=8, null=True, verbose_name='ISSN'), - ), - migrations.AddField( - model_name='document', - name='publisher', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Organization', verbose_name='Publisher'), - ), - migrations.AddField( - model_name='document', - name='source', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Document', verbose_name='Source'), - ), - migrations.AddField( - model_name='document', - name='source_free_input', - field=models.CharField(blank=True, max_length=500, null=True, verbose_name='Source - free input'), - ), - migrations.AddField( - model_name='sourcetype', - name='coins_genre', - field=models.CharField(blank=True, max_length=100, verbose_name='COInS export - genre'), - ), - migrations.AddField( - model_name='sourcetype', - name='coins_type', - field=models.CharField(default='document', max_length=100, verbose_name='COInS export - type'), - ), - migrations.AddField( - model_name='sourcetype', - name='is_localized', - field=models.BooleanField(default=False, help_text='Setting a language for this type of document is relevant', verbose_name='Is localized'), - ), - migrations.AddField( - model_name='document', - name='language', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Language', verbose_name='Language'), - ), - migrations.AddField( - model_name='document', - name='tags', - field=models.ManyToManyField(blank=True, to='ishtar_common.DocumentTag', verbose_name='Tags'), - ), - migrations.AddField( - model_name='ishtarsiteprofile', - name='default_language', - field=models.ForeignKey(blank=True, help_text='If set, by default the selected language will be set for localized documents.', null=True, on_delete=django.db.models.deletion.CASCADE, to='ishtar_common.Language', verbose_name='Default language for documentation'), - ), - ] -- cgit v1.2.3