Skip to content

Commit

Permalink
Breaking-Change: Merge pull request #69 from acdh-oeaw/gp/fix/reset_a…
Browse files Browse the repository at this point in the history
…pp_names!

Gp/fix/reset app names
  • Loading branch information
gregorpirgie authored Mar 1, 2024
2 parents 13b7fea + 96fa35c commit 749570e
Show file tree
Hide file tree
Showing 146 changed files with 2,808 additions and 2,446 deletions.
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,8 @@ VieCPro specific django-apps are added in the root directory, separate from apis

### Table names vs. app names:

For compatibility with prior versions of this repository, where some apps had different names, all table-names of VieCPro specific apps are hardcoded
in all confliciting models via the 'meta.db_table' attribute; i.e. django app names and the prefix of the table names in your database do not exactly match. The mapping is as follows:

- `viecpro_import` == `apis_import_project`
- `viecpro_deduplication` == `dubletten_tool`

So the db-table for f.e. `viecpro_deduplication.models.group` is named `dubletten_tool_group` not `viecpro_deduplication_group`.

See the [Table Names](https://docs.djangoproject.com/en/4.2/ref/models/options/#table-names) - section of the django docs on how django handles model names and table names.
In prior version of this repo, app-names had been changed. This change had no benefits atm and was potential cause for issues.
So it was reverted.

## Development Container

Expand Down
6 changes: 3 additions & 3 deletions apis/settings/apisviecpro_backend_prod.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
SPECTACULAR_SETTINGS["COMPONENT_NO_READ_ONLY_REQUIRED"] = True


INSTALLED_APPS += ["django_extensions", "viecpro_import", "apis_bibsonomy", "apis_ampel",
"viecpro_deduplication", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]
INSTALLED_APPS += ["django_extensions", "apis_import_project", "apis_bibsonomy", "apis_ampel",
"dubletten_tool", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]


DATABASES = {"default":
Expand Down Expand Up @@ -119,7 +119,7 @@
TEMPLATES[0]["DIRS"] += [ROBOTS_TXT_FOLDER, ]


VIECPRO_IMPORT_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"
apis_import_project_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"


# Bibsonomy Settings
Expand Down
6 changes: 3 additions & 3 deletions apis/settings/apisviecpro_backend_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
SPECTACULAR_SETTINGS["COMPONENT_NO_READ_ONLY_REQUIRED"] = True


INSTALLED_APPS += ["django_extensions", "viecpro_import","apis_bibsonomy", "apis_ampel",
"viecpro_deduplication", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]
INSTALLED_APPS += ["django_extensions", "apis_import_project","apis_bibsonomy", "apis_ampel",
"dubletten_tool", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]


DATABASES = {"default":
Expand Down Expand Up @@ -119,7 +119,7 @@
TEMPLATES[0]["DIRS"] += [ROBOTS_TXT_FOLDER, ]


VIECPRO_IMPORT_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"
apis_import_project_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"


# Bibsonomy Settings
Expand Down
6 changes: 3 additions & 3 deletions apis/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
SPECTACULAR_SETTINGS["COMPONENT_NO_READ_ONLY_REQUIRED"] = True


INSTALLED_APPS += ["django_extensions", "viecpro_import", "debug_toolbar", "apis_bibsonomy", "apis_ampel",
"viecpro_deduplication", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]
INSTALLED_APPS += ["django_extensions", "apis_import_project", "debug_toolbar", "apis_bibsonomy", "apis_ampel",
"dubletten_tool", "viecpro_hierarchy", "viecpro_typesense", "viecpro_typesense_detail", "django_celery_results"]


DATABASES = {"default":
Expand Down Expand Up @@ -118,7 +118,7 @@
TEMPLATES[0]["DIRS"] += [ROBOTS_TXT_FOLDER, ]


VIECPRO_IMPORT_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"
apis_import_project_IIIF_BASE_URL = "https://iiif.acdh-dev.oeaw.ac.at/iiif/images/viecpro/"


# Bibsonomy Settings
Expand Down
8 changes: 4 additions & 4 deletions apis/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
urlpatterns.insert(0, url(r'^visualisations/', include("viecpro_hierarchy.urls", namespace="viecpro_hierarchy"))
)

if 'viecpro_import' in settings.INSTALLED_APPS:
if 'apis_import_project' in settings.INSTALLED_APPS:
urlpatterns = urlpatterns + [
url(r'^viecpro_import/', include("viecpro_import.urls", namespace="viecpro_import"))]
url(r'^apis_import_project/', include("apis_import_project.urls", namespace="apis_import_project"))]

if 'viecpro_deduplication' in settings.INSTALLED_APPS:
if 'dubletten_tool' in settings.INSTALLED_APPS:
urlpatterns = urlpatterns + [
url(r'^dubletten/', include("viecpro_deduplication.urls", namespace="viecpro_deduplication")),
url(r'^dubletten/', include("dubletten_tool.urls", namespace="dubletten_tool")),
]

if "apis_bibsonomy" in settings.INSTALLED_APPS:
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion viecpro_import/apps.py → apis_import_project/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


class ViecproImportConfig(AppConfig):
name = 'viecpro_import'
name = 'apis_import_project'
12 changes: 6 additions & 6 deletions viecpro_import/forms.py → apis_import_project/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from apis_core.apis_relations.models import AbstractRelation
from apis_core.apis_vocabularies.models import VocabsBaseClass, AbstractRelationType
from apis_core.apis_labels.forms import LabelForm
from viecpro_import.tables import get_generic_relations_table
from apis_import_project.tables import get_generic_relations_table


from apis_core.helper_functions import DateParser
Expand Down Expand Up @@ -94,7 +94,7 @@ def __init__(self, user=None, *args, **kwargs):
self.helper.add_input(Submit("submit", "Submit"))
self.helper.add_input(Button('cancel', 'Cancel', css_class='btn-danger',
onclick="window.location.href = '{}';".format(
reverse('viecpro_import:project_main'))))
reverse('apis_import_project:project_main'))))


class UploadFileForm(forms.Form):
Expand Down Expand Up @@ -424,7 +424,7 @@ class GenericLabelForm(LabelForm):
# super(GenericLabelForm, self).__init__(*args, **kwargs)
# self.helper.form_tag = True
# self.helper.form_method = "post"
# self.helper.form_action = f"/viecpro_import/create_item/Label"
# self.helper.form_action = f"/apis_import_project/create_item/Label"

def get_generic_vocabs_form(model_name):
module = "apis_core.apis_vocabularies.models"
Expand All @@ -444,7 +444,7 @@ def __init__(self, *args, **kwargs):
Submit("submit", "save", css_class=f"{model_name}Form"))
self.helper.form_method = "post"
self.helper.form_class = "form pdf_tool_itemcreate"
self.helper.form_action = reverse("viecpro_import:item_create", kwargs={
self.helper.form_action = reverse("apis_import_project:item_create", kwargs={
"model_name": model_name})
self.helper.layout = Layout(Field("name",
id=f"{model_name}_name_field"))
Expand All @@ -470,7 +470,7 @@ def __init__(self, *args, **kwargs):
Submit("submit", "save", css_class=f"{model_name}Form"))
self.helper.form_method = "post"
self.helper.form_class = "form pdf_tool_itemcreate"
self.helper.form_action = reverse("viecpro_import:item_create", kwargs={
self.helper.form_action = reverse("apis_import_project:item_create", kwargs={
"model_name": model_name})
self.helper.layout = Layout(Field("name", id=f"{model_name}Form_name_field"),
Field("name_reverse", id=f"{model_name}Form_name_reverse_field"))
Expand All @@ -496,7 +496,7 @@ def __init__(self, *args, **kwargs):
Submit("submit", "save", css_class=f"{model_name}Form"))
self.helper.form_method = "post"
self.helper.form_class = "form pdf_tool_itemcreate"
self.helper.form_action = reverse("viecpro_import:item_create", kwargs={
self.helper.form_action = reverse("apis_import_project:item_create", kwargs={
"model_name": model_name})
self.helper.layout = Layout(Field("name", id=f"{model_name}Form_name_field"),
Field("description", id=f"{model_name}Form_description_field"))
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.18 on 2023-12-04 11:00
# Generated by Django 2.2.11 on 2022-03-09 20:12

from django.conf import settings
from django.db import migrations, models
Expand All @@ -13,8 +13,8 @@ class Migration(migrations.Migration):
('contenttypes', '0002_remove_content_type_name'),
('apis_vocabularies', '0002_texttype_lang'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('apis_entities', '0004_auto_20200722_1231'),
('apis_metainfo', '0006_remove_text_lang'),
('apis_entities', '0004_auto_20200722_1231'),
]

operations = [
Expand All @@ -29,107 +29,80 @@ class Migration(migrations.Migration):
('year', models.CharField(max_length=10)),
('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'apis_import_project_datasource',
},
),
migrations.CreateModel(
name='DataSourcePage',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('page_index', models.IntegerField()),
('page_token', models.CharField(blank=True, max_length=20, null=True)),
('DataSource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.datasource')),
('DataSource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.DataSource')),
],
options={
'db_table': 'apis_import_project_datasourcepage',
},
),
migrations.CreateModel(
name='GenericCollectionEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
],
options={
'db_table': 'apis_import_project_genericcollectionentry',
},
),
migrations.CreateModel(
name='ImportProject',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField(blank=True, help_text='Describe your project here.', max_length=2000, null=True)),
('DataSources', models.ManyToManyField(blank=True, help_text='Consider adding existing Datasources uploaded by you to this Project. Or upload/add additional Datasources later.', to='viecpro_import.DataSource')),
('DataSources', models.ManyToManyField(blank=True, help_text='Consider adding existing Datasources uploaded by you to this Project. Or upload/add additional Datasources later.', to='apis_import_project.DataSource')),
('Editors', models.ManyToManyField(blank=True, help_text='Add users that should be able to edit this project.', related_name='Editors', to=settings.AUTH_USER_MODEL)),
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_metainfo.collection')),
('collection', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_metainfo.Collection')),
('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='owner', to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'apis_import_project_importproject',
},
),
migrations.CreateModel(
name='PageCollection',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_in', models.ManyToManyField(related_name='created', to='viecpro_import.GenericCollectionEntry')),
('edited_in', models.ManyToManyField(related_name='edited', to='viecpro_import.GenericCollectionEntry')),
('created_in', models.ManyToManyField(related_name='created', to='apis_import_project.GenericCollectionEntry')),
('edited_in', models.ManyToManyField(related_name='edited', to='apis_import_project.GenericCollectionEntry')),
],
options={
'db_table': 'apis_import_project_pagecollection',
},
),
migrations.CreateModel(
name='ProjectState',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last_datasource', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='viecpro_import.datasource')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.importproject')),
('last_datasource', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_import_project.DataSource')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.ImportProject')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'apis_import_project_projectstate',
},
),
migrations.CreateModel(
name='ProjectCollectionEntry',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('json', models.TextField(blank=True)),
('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='last_json', to='viecpro_import.genericcollectionentry')),
('project', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.importproject')),
('entry', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='last_json', to='apis_import_project.GenericCollectionEntry')),
('project', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.ImportProject')),
],
options={
'db_table': 'apis_import_project_projectcollectionentry',
},
),
migrations.CreateModel(
name='PageData',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('collection', models.OneToOneField(auto_created=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='viecpro_import.pagecollection')),
('function', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_vocabularies.personinstitutionrelation')),
('institution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_entities.institution')),
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.datasourcepage')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.importproject')),
('collection', models.OneToOneField(auto_created=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_import_project.PageCollection')),
('function', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_vocabularies.PersonInstitutionRelation')),
('institution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_entities.Institution')),
('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.DataSourcePage')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.ImportProject')),
],
options={
'db_table': 'apis_import_project_pagedata',
},
),
migrations.CreateModel(
name='DataSourceProjectState',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('datasource', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.datasource')),
('last_page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='viecpro_import.datasourcepage')),
('project', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='viecpro_import.importproject')),
('datasource', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.DataSource')),
('last_page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='apis_import_project.DataSourcePage')),
('project', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='apis_import_project.ImportProject')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'apis_import_project_datasourceprojectstate',
},
),
]
File renamed without changes.
Loading

0 comments on commit 749570e

Please sign in to comment.