Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undo arches pin, remove REST framework cruft #69

Merged
merged 5 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions arches_controlled_lists/datatypes/datatypes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import uuid
from dataclasses import asdict, dataclass

from django.db.models.fields.json import JSONField
from django.utils.translation import get_language, gettext as _

from arches.app.datatypes.base import BaseDataType
Expand All @@ -28,8 +27,6 @@ class Reference:


class ReferenceDataType(BaseDataType):
rest_framework_model_field = JSONField(null=True)
Copy link
Member Author

@jacobtylerwalls jacobtylerwalls Mar 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm moving away from a pattern that expects this to exist on the python datatypes in favor of a fully isolated mapping so that API clients don't leak into the python datatypes.

To test this, you'd need to be on archesproject/arches-lingo#240, or we can just let the dust settle tomorrow.


def to_python(self, value):
if value is None:
return None
Expand Down
2 changes: 1 addition & 1 deletion arches_controlled_lists/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def remove_view_plugin(apps, schema_editor):
migrations.AddConstraint(
model_name="listitemvalue",
constraint=models.CheckConstraint(
condition=models.Q(
check=models.Q(
("language_id__isnull", False),
("valuetype", "image"),
_connector="OR",
Expand Down
2 changes: 1 addition & 1 deletion arches_controlled_lists/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class Meta:
),
),
models.CheckConstraint(
condition=Q(language_id__isnull=False) | Q(valuetype="image"),
check=Q(language_id__isnull=False) | Q(valuetype="image"),
name="only_images_nullable_language",
violation_error_message=_(
"Item values must be associated with a language."
Expand Down
2 changes: 1 addition & 1 deletion arches_controlled_lists/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
"arches.app.models",
"arches.management",
"guardian",
"captcha",
# "captcha", restore after dropping 7.6 support
"revproxy",
"corsheaders",
"oauth2_provider",
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Django",
"Framework :: Django :: 5.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.2",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Intended Audience :: Information Technology",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
]
requires-python = ">=3.10"
dependencies = [
"arches @ git+https://github.com/archesproject/arches.git@jtw/pythonic-resource-models",
"arches>=7.6.0",
"arches-vue-utils @ git+https://github.com/archesproject/arches-vue-utils.git@main",
]
version = "0.0.1"
Expand Down
6 changes: 3 additions & 3 deletions tests/cli_tests.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import io
import os
import unittest

from django.core import management
from django.urls import reverse
from django.test import TestCase
from django.test.client import Client
from django.test.utils import captured_stdout
from django.core.management.base import CommandError

from arches import __version__ as arches_version
from arches.app.models.models import Node
from arches.app.utils.skos import SKOSReader
from arches_controlled_lists.models import List, ListItem, ListItemValue

from .test_settings import PROJECT_TEST_ROOT
Expand Down Expand Up @@ -160,6 +159,7 @@ def test_no_matching_language_error(self):
self.assertEqual(expected_output, str(e.exception))


@unittest.skipUnless(arches_version >= "8", reason="Fixtures were created for Arches v8")
class MigrateConceptNodesToReferenceDatatypeTests(TestCase):
# Test data has three models:
# - `Concept Node Migration Test`, with four concept nodes
Expand Down
117 changes: 0 additions & 117 deletions tests/fixtures/data/concept_node_migration_test_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -2104,46 +2104,6 @@
"source_identifier": null
}
},
{
"model": "models.concept",
"pk": "00000000-0000-0000-0000-000000000001",
"fields": {
"nodetype": "ConceptScheme",
"legacyoid": "ARCHES"
}
},
{
"model": "models.concept",
"pk": "00000000-0000-0000-0000-000000000004",
"fields": {
"nodetype": "Concept",
"legacyoid": "ARCHES RESOURCE CROSS-REFERENCE RELATIONSHIP TYPES CONCEPT"
}
},
{
"model": "models.concept",
"pk": "00000000-0000-0000-0000-000000000005",
"fields": {
"nodetype": "Collection",
"legacyoid": "ARCHES RESOURCE CROSS-REFERENCE RELATIONSHIP TYPES COLLECTION"
}
},
{
"model": "models.concept",
"pk": "00000000-0000-0000-0000-000000000006",
"fields": {
"nodetype": "ConceptScheme",
"legacyoid": "CANDIDATES"
}
},
{
"model": "models.concept",
"pk": "00000000-0000-0000-0000-000000000007",
"fields": {
"nodetype": "Concept",
"legacyoid": "DEFAULT RESOURCE TO RESOURCE RELATIONSHIP TYPE"
}
},
{
"model": "models.concept",
"pk": "2a259f4b-807c-4574-b681-47fef3086d88",
Expand Down Expand Up @@ -7678,33 +7638,6 @@
"relationtype": "narrower"
}
},
{
"model": "models.relation",
"pk": "d9918fb4-96e1-11ef-9dd1-7b5ac4a2a1e3",
"fields": {
"conceptfrom": "00000000-0000-0000-0000-000000000001",
"conceptto": "00000000-0000-0000-0000-000000000004",
"relationtype": "hasTopConcept"
}
},
{
"model": "models.relation",
"pk": "d991aa8a-96e1-11ef-9dd1-c30af9e29f7a",
"fields": {
"conceptfrom": "00000000-0000-0000-0000-000000000005",
"conceptto": "00000000-0000-0000-0000-000000000007",
"relationtype": "member"
}
},
{
"model": "models.relation",
"pk": "d9b81a6c-96e1-11ef-9dd1-1713c8e4a74e",
"fields": {
"conceptfrom": "00000000-0000-0000-0000-000000000004",
"conceptto": "00000000-0000-0000-0000-000000000007",
"relationtype": "narrower"
}
},
{
"model": "models.resourceinstance",
"pk": "a106c400-260c-11e7-a604-14109fd34195",
Expand Down Expand Up @@ -8010,26 +7943,6 @@
"language": "en"
}
},
{
"model": "models.value",
"pk": "ac41d9be-79db-4256-b368-2f4559cfbe55",
"fields": {
"concept": "00000000-0000-0000-0000-000000000007",
"valuetype": "prefLabel",
"value": "is related to",
"language": "en"
}
},
{
"model": "models.value",
"pk": "c12e7e6c-e417-11e6-b14b-0738913905b4",
"fields": {
"concept": "00000000-0000-0000-0000-000000000004",
"valuetype": "prefLabel",
"value": "Resource To Resource Relationship Types",
"language": "en"
}
},
{
"model": "models.value",
"pk": "ce3d6820-6fb4-4f7b-9971-c4e287a11558",
Expand All @@ -8040,26 +7953,6 @@
"language": "en"
}
},
{
"model": "models.value",
"pk": "d8c60bf4-e786-11e6-905a-b756ec83dad5",
"fields": {
"concept": "00000000-0000-0000-0000-000000000001",
"valuetype": "prefLabel",
"value": "Arches",
"language": "en"
}
},
{
"model": "models.value",
"pk": "d8c622f6-e786-11e6-905a-475a5eee86f5",
"fields": {
"concept": "00000000-0000-0000-0000-000000000005",
"valuetype": "prefLabel",
"value": "Resource To Resource Relationship Types",
"language": "en"
}
},
{
"model": "models.value",
"pk": "eab6d1fd-4030-4040-a7ed-aa99dbd4c2fe",
Expand All @@ -8080,16 +7973,6 @@
"language": "en"
}
},
{
"model": "models.value",
"pk": "fee39428-e83f-11e6-b49d-9b976819ac02",
"fields": {
"concept": "00000000-0000-0000-0000-000000000006",
"valuetype": "prefLabel",
"value": "Candidates",
"language": "en"
}
},
{
"model": "models.widget",
"pk": "10000000-0000-0000-0000-000000000001",
Expand Down
Loading
Loading