diff --git a/apis_ontology/migrations/0045_rename_end_start_date_event_end_date_from_and_more.py b/apis_ontology/migrations/0045_rename_end_start_date_event_end_date_from_and_more.py new file mode 100644 index 0000000..7fab0df --- /dev/null +++ b/apis_ontology/migrations/0045_rename_end_start_date_event_end_date_from_and_more.py @@ -0,0 +1,119 @@ +# Generated by Django 5.1.4 on 2024-12-20 07:33 + +import django_interval.fields +from django.db import migrations + +migration_list = lambda model: [ + migrations.RenameField( + model_name=model, + old_name='end_date_written', + new_name='end', + ), + migrations.RenameField( + model_name=model, + old_name='end_start_date', + new_name='end_date_from', + ), + migrations.RenameField( + model_name=model, + old_name='end_date', + new_name='end_date_sort', + ), + migrations.RenameField( + model_name=model, + old_name='end_end_date', + new_name='end_date_to', + ), + migrations.RenameField( + model_name=model, + old_name='start_date_written', + new_name='start', + ), + migrations.RenameField( + model_name=model, + old_name='start_start_date', + new_name='start_date_from', + ), + migrations.RenameField( + model_name=model, + old_name='start_date', + new_name='start_date_sort', + ), + migrations.RenameField( + model_name=model, + old_name='start_end_date', + new_name='start_date_to', + ), + migrations.AlterField( + model_name=model, + name='start', + field=django_interval.fields.FuzzyDateParserField(blank=True, max_length=255, null=True, verbose_name='Start'), + ), + migrations.AlterField( + model_name=model, + name='end', + field=django_interval.fields.FuzzyDateParserField(blank=True, max_length=255, null=True, verbose_name='Start'), + ), +] +entities = ['event', 'institution', 'person', 'place', 'work'] +relations = [ + 'hatreligionszugehoerigkeit', + 'personeventlegacyrelation', + 'personinstitutionlegacyrelation', + 'personpersonlegacyrelation', + 'institutioninstitutionlegacyrelation', + 'personplacelegacyrelation', + 'personworklegacyrelation', + 'placeplacelegacyrelation', + 'wargeschwistervon', + 'warschwagerschwaegerinvon', + 'warschwiegersohnschwiegertochtervon', + 'warverwandtmit', + 'hattealstrauzeugenzeugin', + 'warpatenkindvon', + 'dissertiertebeiunter', + 'wurdegeborenin', + 'starbin', + 'erhieltausbildungin', + 'wirkteforschtehieltsichaufin', + 'studiertelerntean', + 'habilitiertesichan', + 'warassistentinan', + 'warprivatdozentinan', + 'warotitoprofessorinan', + 'waraotitaoprofessorinan', + 'warhonorarprofessorinan', + 'warehrendoktorinan', + 'wartaetigfuerwirkteanbei', + 'warmitgruenderinvon', + 'hatteleitungsfunktionan', + 'warmitgliedvon', + 'wargrossvatermuttervon', + 'warrektorinan', + 'wardekaninan', + 'promoviertean', + 'kaempfteinbei', + 'warprofessorinan', + 'graduiertean', + 'mitbiographiertunter', + 'warhonorardozentinan', + 'hatteleitungsfunktionbei', + 'nahmteilan', + 'warelternteilvon', + 'warschuelerinvon', + 'warverheiratetmit', + 'standinkontaktmit', + 'arbeitetezusammenmit', + 'wurdeerhobenin', + 'wargeburtstitelvon', + 'fandstattin'] +allmodels = entities + relations + [f"version{entity}" for entity in entities] + [f"version{relation}" for relation in relations] + + +class Migration(migrations.Migration): + + dependencies = [ + ('apis_ontology', '0044_person_alternative_names_new_and_more'), + ] + + operations = [item for model in allmodels for item in migration_list(model)] diff --git a/apis_ontology/models.py b/apis_ontology/models.py index d31befb..9190cf1 100644 --- a/apis_ontology/models.py +++ b/apis_ontology/models.py @@ -6,16 +6,24 @@ from django.utils.translation import gettext_lazy as _ from apis_core.apis_entities.models import AbstractEntity -from apis_core.core.models import LegacyDateMixin from apis_core.utils.helpers import create_object_from_uri from apis_core.generic.abc import GenericModel from apis_core.apis_entities.abc import E53_Place from apis_core.history.models import VersionMixin from django_json_editor_field.fields import JSONEditorField +from django_interval.fields import FuzzyDateParserField from auditlog.registry import auditlog +class LegacyDateMixin(models.Model): + start = FuzzyDateParserField(max_length=255, blank=True, null=True, verbose_name=_("Start")) + end = FuzzyDateParserField(max_length=255, blank=True, null=True, verbose_name=_("End")) + + class Meta: + abstract = True + + class OEBLBaseEntity: pass