-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(models): override LegacyDateMixin
We override the apis_core shipped LegacyDateMixin with one that uses django_intervals FuzzyDateParserField. The migration runs through all the relevant fields and renames and alters them.
- Loading branch information
Showing
2 changed files
with
128 additions
and
1 deletion.
There are no files selected for viewing
119 changes: 119 additions & 0 deletions
119
apis_ontology/migrations/0045_rename_end_start_date_event_end_date_from_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters