-
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.
1. modified entity form and filter set for person 2. parler works but migrations are buggy; need to be edited by handel 3. TODO: Data migrations 4. TODO: Postsave signal to save translations/transliterations automatically
- Loading branch information
Showing
14 changed files
with
317 additions
and
47 deletions.
There are no files selected for viewing
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,11 @@ | ||
from django.contrib import admin | ||
from parler.admin import TranslatableAdmin | ||
|
||
from .models import Person | ||
|
||
|
||
@admin.register(Person) | ||
class PersonAdmin(TranslatableAdmin): | ||
# TODO: allow editing the translations here? | ||
list_display = ["name", "all_languages_column"] | ||
pass |
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
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
Empty file.
107 changes: 107 additions & 0 deletions
107
apis_ontology/migrations/0031_alter_person_options_alter_versionperson_options_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,107 @@ | ||
# Generated by Django 5.1.3 on 2024-11-15 21:53 | ||
|
||
import django.db.models.deletion | ||
import parler.fields | ||
import parler.models | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("apis_ontology", "0030_alter_versioninstance_options_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="person", | ||
options={}, | ||
), | ||
migrations.AlterModelOptions( | ||
name="versionperson", | ||
options={ | ||
"get_latest_by": ("history_date", "history_id"), | ||
"ordering": ("-history_date", "-history_id"), | ||
"verbose_name": "historical person", | ||
"verbose_name_plural": "historical persons", | ||
}, | ||
), | ||
migrations.RemoveField( | ||
model_name="person", | ||
name="name", | ||
), | ||
migrations.RemoveField( | ||
model_name="versionperson", | ||
name="name", | ||
), | ||
migrations.AddField( | ||
model_name="person", | ||
name="name_latin", | ||
field=models.CharField( | ||
blank=True, | ||
default="", | ||
editable=False, | ||
max_length=255, | ||
verbose_name="Name", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="versionperson", | ||
name="name_latin", | ||
field=models.CharField( | ||
blank=True, | ||
default="", | ||
editable=False, | ||
max_length=255, | ||
verbose_name="Name", | ||
), | ||
), | ||
migrations.CreateModel( | ||
name="PersonTranslation", | ||
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" | ||
), | ||
), | ||
( | ||
"name", | ||
models.CharField( | ||
blank=True, default="", max_length=255, verbose_name="Name" | ||
), | ||
), | ||
( | ||
"master", | ||
parler.fields.TranslationsForeignKey( | ||
editable=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="translations", | ||
to="apis_ontology.person", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "person Translation", | ||
"db_table": "apis_ontology_person_translation", | ||
"db_tablespace": "", | ||
"managed": True, | ||
"default_permissions": (), | ||
"unique_together": {("language_code", "master")}, | ||
}, | ||
bases=(parler.models.TranslatableModel, models.Model), | ||
), | ||
migrations.RunSQL( | ||
"INSERT INTO apis_ontology_person_translation(language_code, name , master_id) SELECT 'en', name_latin, rootobject_ptr_id FROM apis_ontology_person;" | ||
), | ||
] |
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
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,5 @@ | ||
from parler.managers import TranslatableQuerySet | ||
|
||
|
||
class PersonQuerySet(TranslatableQuerySet): | ||
pass |
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
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
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
Oops, something went wrong.